in reply to Re: Win32::Gui + Threading?
in thread Win32::Gui + Threading?

I think the script is lost, but here is an example that might help:

use Win32::GUI; $Win = new Win32::GUI::Window( -left => 341, -top => 218, -width => 300, -height => 191, -name => "Win", -text => "Window Title" ); $Win->Show(); $Win->AddLabel( -text => "Test", -name => "Test", -left => 121, -top => 72, -width => 49, -height => 16, -foreground => 0, ); $Win->AddButton( -text => "Do it", -name => "doit", -left => 100, -top => 90, -width => 65, -height => 24, ); Win32::GUI::Dialog(); sub doit_Click { $t1 = $Win->AddTimer('T1', 10); } sub T1_Timer { # This gets called over and over again $i++; $Win->Test->Change(-text => "$i"); # You can put code here to read # from a line from a socket or file # and the GUI won't freeze up. }

Replies are listed 'Best First'.
Re: Re: Re: Win32::Gui + Threading?
by Flame (Deacon) on Nov 12, 2001 at 07:32 UTC
    Hmm, it looks promising... but I really can't tie up the users internet connection like that (constant polling)...


    -----BEGIN GEEK CODE BLOCK-----
    Version: 3.12
    GIT d- s:++ a--- C++++ UL P+++>++++ L+ E- W++>+++ N !o K- W+ O---- M-- V--
    PS PE Y- PGP t++(+++) 5(+++)++++ X R+@ tv+ b+++ DI+ D- G e->+++ h! r-- y-
    ------END GEEK CODE BLOCK------
    Translate

    "Weird things happen, get used to it."

    Flame ~ Lead Programmer: GMS

      Although I'm not sure what you're trying to do, you don't have to constantly poll. Maybe something like this pseudo-code:
      On button click->add timer to do subroutine A. sub A() { if(socket != EOF) { open socket, read line. } else { kill timer. } }
      Hope this helps.