Re: how do I close the dialog and at the same time run a subroutine in the background



On Fri, 2009-12-04 at 20:29 +0800, lointaineimage wrote:
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;
  }

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

I think this would do the trick:

#...
$dialog->destroy;

Gtk2->main_iteration() while Gtk2->events_pending(); # Inserted line

&mysubroutine;
#...

PÃter JuhÃsz




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]