Re: Getting parent Gtk::window



I use (Gtk::Window&)(*this->get_toplevel()) from a child widget for
display dialogs, for example:

// Display error message
Gtk::MessageDialog err_dialog( (Gtk::Window&)(*this->get_toplevel()),
	_("Unexpected exception"), false, Gtk::MESSAGE_ERROR );

err_dialog.set_secondary_text (e.what());
err_dialog.run();

in this way you don't need to disable sensitivity.

Il giorno gio, 15/01/2009 alle 16.04 +0000, Pedro Sousa ha scritto:
> Hi to all,
> 
> I can't find information how to get a pointer to a widget parent
> Gtk::Window. I know that the method "get_parent_window" return the a
> Glib::RefPtr<Gdk::Window>, but this isn't useful because I can't use it
> with the method "set_transient_for" for a local Gtk::Dialog.
> Another task I need to perform with the parent window pointer is to
> enable or disable the sensitivity of the parent window.
> 
> I saw a solution, which was to copy a pointer of the base window into
> its children. And the children copy, again, the pointer to its children,
> etc. For example, this behavior can be implemented using the class
> constructor
> 
> MessageDialog::MessageDialog (Gtk::Window* parentWindow) :
>     mWidgetParent (parentWindow)
> {
> }
> 
> I don't like this solution, because is very error prune. Is this the
> only possible solution?
> 
> Best regards
> Pedro Sousa
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list



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