Re: best way to use multiple windows



Hi,

my approach to this is to derive such windows from Gtk::Dialog and to
add two buttons with Gtk::RESPONSE_OK and Gtk::RESPONSE_CANCEL. To show
the dialog, simply do

MyDialog dialog(*this, foo, bar);
if(dialog.run() == Gtk::RESPONSE_OK)
{
  // Take settings into main app
}

Gtk::Dialog::run blocks in a main loop until the user closes the window
by either pressing one of the buttons or closing the window (which fits
perfectly if you want modal windows). After your function returns, the
dialog will be destroyed automatically as it runs out of scope, so you
do not have to worry about memory management.

 - Armin



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