[Gtk-sharp-list] (best practices) how to retrieve the output from the dialog

Maciej Pilichowski bluedzins at wp.pl
Sun May 2 13:11:41 EDT 2010


Hi,

  This is in some way continuation of my old post about showing modal 
dialog "How to show dialog modal and wait for it?".

  I still have problems to come up with elegant way to show and 
respond to the output of the dialog.

  Example: main window + custom filter dialog (modal). If user press 
OK in dialog the data in main window should be filtered, if user 
cancels dialog, nothing should happen.

  Normally I would write something like this:

  dlg.Show();
  if (dlg.Filter!=null)
    // do filtering

  In Gtk# world this is incorrect, because the if clause is executed 
before dlg closes.

  I figured out that I can write additional functions -- even 
handlers -- one per each dialog I use, but this is ugly for me 
(having N dialogs results in N triggers, one liners usually, and N 
output handlers).

  So, what is the best (elegant!) practice for this in Gtk#?

Cheers,


More information about the Gtk-sharp-list mailing list