Re: Gtk2::MessageDialog title




On Nov 20, 2009, at 11:01 PM, Zettai Muri wrote:

Is it possible to set the title of a MessageDialog?

Of course. Gtk2::MessageDialog isa Gtk2::Dialog isa Gtk2::Window, so just just Gtk2::Window::set_title(). See below.


But beware that the gnome human interface guidelines say that alert windows should have no title, as the title would normally just duplicate the text of the message... so, depending on what you're doing, you might actually want to blank out the title.

http://library.gnome.org/devel/hig-book/stable/windows-alert.html.en


I have the following:

sub show_duplicate_dialog
{
    #
    # A modal dialog.  Note that the message is a printf-style format.
    #
    my($duplicate) = @_;
    my($dialog) = Gtk2::MessageDialog->new (undef,
                                    'destroy-with-parent',
                                    'error', # message type
                                    'ok', # which set of buttons?
                                    #printf format:
                                    "\"%s\" already selected.",
                                    $duplicate);

$dialog->set_title ("Fooo");

    my($response) = $dialog->run;
    $dialog->destroy;

}

But can't work out how to add a title to the dialog box that appears.

For each widget in Gtk2 there is a man page; each man page has a HIERARCHY section, which shows the class ancestry for that type. Or you can look at the C api reference on gtk.org, which has the same info in a different format.

--
Applause is an addiction, like heroin or checking your email.
  -- Sideshow Mel




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