This model works quite well: -
use win32::GUI;
use threads;
use Thread::Queue; # contruct GUI here --> my $commandQueue = Thread::Queue->new;
threads->new(sub {
        while (my $command = $commandQueue->dequeue) {
                eval $command; warn $@ if $@;
        }
}); Win32::GUI::Dialog;
sub SomeButton_Click {
        $commandQueue->enqueue("&somefunction(\$with_vars_as_refs)");
} __END You will have access in the thread to any variable created before. You may want to use a Timer to start the thread etc.. Blair.

1. When using threading with win32::gui, would/could I create a thread for each gui component/object? For example, from my Master loop, could I create a thread that held a Window and every button, textfield, etc. contained inside the Window, while another thread held a Dialog Box with all of it"s components (textfields, buttons, etc.)? 2. If I can, from where do I control the Show() method? I tried performing this from the Master Loop, but it said, of course, that my $Window didn"t exist. Then, I tried passing the Show() through the thread (e.g. $sample_thread->$Window->Show();), but that didn"t work either.


Reply via email to