Let me rephrase the OP's question. I believe the OP wants to remove the cancel button from the AddItem sub so that the popup window it is creating has no way to exit from the user (well, the window close button that the window manager puts in automatically may be there, but we can work on that later). This window will be visible for the duration while the perl program continues to do stuff in the background to prepare whatever, e.g., sleep 3.
And then, once this setup is done, the OP wishes that this extra status window disappears as if the user had pressed the (now-removed) cancel button.
In other languages, my first thought is to create a background thread to do the real work in, leaving the main loop on the main thread free to handle events. However, I've not done GUI programming in ages - last time I did any GUI programming on Unix was when I was learning Java, and, before that, all GUI programming had been Win16, OS/2, and Win32 - in C and Delphi Pascal. Java handles threads in a relatively transparent method, with sensible sharing, IMO. Perl's threads ... well, I'd love to hear the answer to the OP to see how I can take advantage of it in other stuff I'd like to do ;-)
| [reply] [d/l] |
Ok, I'll try a bit more detail...
I have a command line program that I run under WinXP and ActivePerl... but my work colleagues are... 'loathe'... to use non-Window applications. Hence, I'm trying to build a very simple GUI around it.
So my GUI (that is, Perl/Tk) application displays a window that captures user input in fields, etc. The user clicks a 'Do it!' button and that button calls a sub{}.
In the sub, I create a command line from the user input. I then do a `$cmd`, system($cmd) or a Win32::Process::Create(...$cmd...) to run my command line program and when it's finished and control returns to my Perl/Tk app, I then further process the file created by my command line app.
When the 'spawn' (or 'fork') runs, it takes a little too long to do its thing to just have nothing being displayed in the window I have up. So, I thought I'd pop-up a window saying "Working" whilst the 'spawn' is running and then get rid of the popup when the 'spawn' terminates (the people this is for won't read status lines on a window - they don't 'see' such things - but popup windows are more obvious for them and they generally notice popups).
Does this make my intent any clearer?
Ta
John
| [reply] |