I hope somebody can help on this one. I need to use a cancel button so
the user can break out of a routine which is running. Problem is, the
button cannot be pressed until the action has completed.

Run this and you'll see that as long as the loop is counting, the
button click event will not respond. Can this be changed so that the
click event is checked beforehand?


use Win32::GUI;

$win = new Win32::GUI::Window(
        -name => 'MainWindow',
        -size => [200, 200],
        );

$win->AddButton(
        -name => "CancelButton",
        -text => "Cancel",
        -left => 50,
        -top => 100,
        );

$win->Show();

# Just print some numbers, updating the window so that the button
remains visible.

for my $i (0..1500) {print "$i,"; $win->Update();}
                
        Win32::GUI::Dialog();

        return(1);


sub ::CancelButton_Click {

print "Cancel request.\n";
}


__END__


Thanks,

Marcus




Reply via email to