Re: item factories revisited



On Tue, 2003-08-05 at 17:42, Gavin Brown wrote:
I would be grateful if people on the list could test this script and
tell me if they see the following:

* top level menu items print a line when clicked
* the first time a second level item is clicked it prints a line
* any future clicks on second level items do nothing

I've verified this on three separate systems (all RH9, but one using
XD2) and i'd like to see if it happens on other distros.

I'm pretty sure that the icon factory structure is OK - surely if it
builds the widgets it's OK?

Thanks in advance,

Gavin.

change the signal connect code to the following and everything works
fine. have a look at
http://developer.gnome.org/doc/API/2.0/gtk/GtkMenu.html#gtk-menu-popup
to see what the change was inspired by. essentially you needed to pass
$event->button, and $event->time into the menu popup. doc there does
mention that several of the parameters are normally NULL/undef, but
button and time apparently shouldn't be.

$button->signal_connect('event', sub { 
        shift;
        my $event = shift;
        return 0 unless( ref $event eq 'Gtk2::Gdk::Event::Button' );
        $menu->popup(undef, undef, undef, undef, 
                $event->button, $event->time);
        1;
});

have a look at the tutorial for item factory for a much more complicated
example that does exactly the same thing when it comes time to popup the
menu.

-rm




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