PDA

View Full Version : gtk2-perl how do I close the dialog and at the same time run a subroutine



lointaineimage
December 4th, 2009, 02:18 PM
hello!
I want to destroy the dialog and call a subroutine when I click the
"yes" button,here is part of my code ,but it doesn't work well,the
dialog is closed until the subroutine is finished.waiting for your
help,thanks!

here is part of my code:
#=========================================
my $dialog =Gtk2::MessageDialog->new
($window,'destroy-with-parent','something to confirm','yes-no',");
my $response = $dialog->run;
if($response eq "yes"){
$dialog->destroy;
&mysubroutine;
}

slavik
December 4th, 2009, 10:12 PM
threads, have the dialog start a new detached thread for the subroutine.

lointaineimage
December 6th, 2009, 07:45 AM
threads, have the dialog start a new detached thread for the subroutine.
thank you for replying;
i found another way by add "Gtk2->main_iteration while Gtk2->events_pending;" in my subroutine, it's simple but may not be security.