okay, i think i see what you mean...you want a GUI that starts a loop
which can conditionally spawn a second window, and when that second
windows is closed, it returns to the loop and continues processing...

i can't figure it out either...my current theory is that since the
Loop_Click event has not exited, another click event (OK_Click) cannot
be registered...

you can do something like this to exit the loop (thereby exiting the
click event) prior to displaying the window, but then you have to pull
some shysty manoeuvres to maintain state and get the loop going again:
======================================= 

sub Loop_Click {

        while ($i<20) {
                sleep 1;
                

                last if ($i==10);

                $i++;
                }

&Show_Win2($i);

$i++;
}
=======================================

if anyone knows of a better way to handle this, please contribute...





for reference, here is the full script that i am playing with:

========================================

use Win32::GUI;

$i=0;

$Win = new Win32::GUI::Window(
      -left   => 341,
      -top    => 218,
      -width  => 300,
      -height => 213,
      -name   => "Win",
      -text   => "Window Title"
      );



$Win->AddButton(
       -text    => "Loop",
       -name    => "Loop",
       -left    => 104.5,
       -top     => 102,
       -width   => 95,
       -height  => 28,
      );

$Win2 = new Win32::GUI::Window(
      -left   => 391,
      -top    => 238,
      -width  => 200,
      -height => 183,
      -name   => "Win2",
      -title   => "New Window",
      );

$Win2->AddLabel(
       -text    => "",
       -name    => "Label",
       -left    => 60,
       -top     => 30,
       -width   => 20,
       -height  => 20,
      );

$Win2->AddButton(
       -text    => "OK",
       -name    => "OK",
       -left    => 50,
       -top     => 102,
       -width   => 95,
       -height  => 28,
      );

$Win->Show();

Win32::GUI::Dialog();

sub Win_Terminate {
   return -1;
}

sub OK_Click {
   

   $Win2->Hide();
}

sub Loop_Click {

        while ($i<20) {
                sleep 1;
                

                if ($i==10){
                        &Show_Win2($i);
                        }

                $i++;
                }

}

sub Show_Win2 {
   my $num = shift;

   $Win2->Label->Text($num);
   $Win2->Show();
   $Win2->Update();
   
   
  
}

Reply via email to