before all i want say "sorry!" to all about my bad English =( its about event loop and modal condition window.
use Win32::GUI; $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, ); print "$Win->{-handle}\t$Win2->{-handle}\n"; $Win->Show(); Win32::GUI::Dialog(); $global=0; sub Win_Terminate { return -1; } sub Loop_Click { foreach $i (0 ... 3) { $Win->Disable(); Show_Win2($i); while (!$global) { Win32::GUI::DoEvents(); #sleep 1; #sleep functionality =) select(undef, undef, undef, 0.1); } $global=0; print "ok$i"; sleep 1; } } sub Win2_Terminate{ return -1; } sub Show_Win2 { my($num) = @_; $Win2->Label->Text($num); $Win2->Show(); $Win2->Update(); # "This will make the OK button show up, but # the window will not wait for a click of the OK." # this behavior was before we add while loop in "sub Loop_Click" # with this loop we see expected behavior # first this question i see from David Hiltz } sub OK_Click { $Win->Enable(); $Win2->Hide(); $global=1; return 1; }