Re: example of menu



haratron  wrote:
I can't find any example of a menu (file, edit, help) in gtk-perl. The
best I could find was appwindow.pl in gtk-demo, but that doesn't have
the actual functions implemented, just dummy dialogs.
I'm using Glade.
How am I going to launch the aboutdialog when the user clicks on the
help->about menuitem? 
you will find the menu bar under "Containers"

For an About box create in Glade inside your project a new Widget (an AboutBox/About Dialog - found under 
Toplevels)
In the About box there's a button. click it, switch to Signals and set GtkButton->clicked to a function 
e.g.on_AboutBoxButtonClose_clicked

If you double click on the Menu point it opens the sub menu entries, click on about and set under Signals
Gtk-Widget->button-press-event a function e.g. on_ImageMenuItemInfo_button_press_event

Then in the perl script:
# Get About Box object as named in the glade project
my $aboutbox = $builder->get_object('AboutBox');
$aboutbox->signal_connect('delete_event' => => \&Gtk2::Widget::hide_on_delete);

sub on_ImageMenuItemInfo_button_press_event()
{
    $aboutbox->show();
}

sub on_AboutBoxButtonClose_clicked()
{
    $aboutbox->hide();
}

That's it. Hope it helps
--Thomas
___________________________________________________________
GRATIS! Movie-FLAT mit Ãber 300 Videos. 
Jetzt freischalten unter http://movieflat.web.de



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