This shows a possible bug where a modal dialog loses its
modality. Try clicking on the close button of the main
window after opening the modal window - the modal
dialog closes, and a second click is need to then close the
main window. The main window should be disabled.
If the code to center the dialog is moved to an
callback (or removed), then it all works fine.
If the modal window is also a dialog window (-dialogui
then it's special navigation features are lost (i.e.
stops working, return = OK does not work).
(1) Don't Center (or otherwise move the dialog) before
doModal. I have resolved this by putting the Center()
an onActivate handler.
(2) If you only have one top-level window, set the
to 1. I.e. $modal->DoModal(1).
my $mw = Win32::GUI::Window->new(
-title => "doModal() Bug",
-pos => [100,100],
-size => [200,200],
-text => "Open Modal Window",
-onClick => \&openModal,
my $modal = Win32::GUI::Window->new(
-parent => $mw,
-title => "Modal Window",
-size => [100,100],
# Comment out this next line to see correct behaviour
Log in to post a comment.