Re: how to handle multiple windows.

On Aug 26, 2009, at 9:47 AM, Sreejith S wrote:


I have multiple windows in my Gtk2-Perl project.i have already designed and
coded each one.How can i call a window from another window,when i
press a button in the main window.I also need to pass some values from
one window to other as arguments...

That depends rather intimately on how you have set up your code to create the windows.

In general, your Button's "clicked" handler can scrape together whatever it needs and then call the function that constructs your other window. For example,

   $window1_doit_button->signal_connect (clicked => sub {
           my $arg1 = $window1_arg1_entry->get_text ();
           my $arg2 = $window1_arg2_checkbox->get_active ();

           create_window_2 ($arg1, $arg2);

The main loop is still running, so assuming that create_window_2() calls ->show on the new window, everything should Just Work.

There are other issues if window2 is a modal dialog, etc, so, as hinted above, more information will get you a better answer.

I hate to break it to you, but magic data pixies don't exist.
  -- Simon Cozens

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