Re: GtkMessageDialog convenience method
- From: "J. Baltasar Garcia Perez-Schofield" <jbgarcia uvigo es>
- To: Vladimir Prus <ghost cs msu su>, gtkmm-list gnome org
- Subject: Re: GtkMessageDialog convenience method
- Date: Mon, 29 May 2006 10:48:24 +0200
Hi, Volodya !
> It looks like GtkMessageDialog does not provide a convenience method to create
> a message both with both primary and secondary text and run it, something
> window, "Something bad happened", "Check your karma");
> Instead, I need to use:
> GtkMessageDialog d(..............);
> Is the lack of such convenience method by design, or nobody ever asked for it,
> or nobody has the right yet to implement it?
I indeed suggested some time ago the creation of convenience functions
being in charge of creating the dialog, running it and returning. Some
of them are shown below:
/** Shows an error or information message
@param w The window this dialog depends on
@param msg The message to be shown
@param msg_sec the secondary message (explanation) to be shown.
const Glib::ustring &msg,
const Glib::ustring &sec_msg,
Gtk::MessageType message_type = Gtk::MESSAGE_INFO);
/** Asks for information: prompts a dialog wth an entry box in order
for the user to introduce the info required.
@param title The title of the dialog
@param requirement The main question (will appear in bold face)
@param explanation Small help to assist the user on the info to enter
@return an String containing the info introduced by the user. It will
empty if the user pressed the cancel button.
const Glib::ustring &title,
const Glib::ustring &requirement,
const Glib::ustring &explanation);
Their implementation is quite straightforward, though I've found these
functions very useful (I don't have to dive into the documentation just
for showing a message). This is, of course, not the same as overloading
constructors in order to be able to get access to all features at the
time of creation. But it's similar. If you want more complex behaviours,
then you'll have to create the dialog and deal with it as usual.
Another possibility would be to create these functions as static
methods of Gtk::MessageDialog, this way they would be encapsulated.
Anyway, if you are interested in the source code (a .h file), don't
hesitate to contact me.
PBC -- J. Baltasar García Perez-Schofield
jbgarcia en uvigo de es http://webs.uvigo.es/jbgarcia/
Dep. Informática, Universidad de Vigo, España (Spain)
] [Thread Prev