Re: I want popup menus :(



On Mon, Jul 19, 2004 at 12:40:12 +0200, Torsten Schoenfeld wrote:
On Mon, 2004-07-19 at 12:25, Art?ras Šlajus wrote:

$usertree->signal_connect('button-press-event' => sub {
     my $event = $_[1];
     if ($event->button == 3) {
         $gladexml->get_widget('pmUsers')->popup(undef, undef, undef,
             user_selected(), $event->button, 0);
         return TRUE;
     }
     else {
         return FALSE;
     }
} );

Why do you put user_selected() in the user data slot of popup()?  It
would only be used if you provided a positioning callback.

other way popup appears and disappears quickly.

That's because you connected to button-press-event.  Those kind of popup
menus only stay up if you don't release the mouse button.  If you want
the more traditional behavior, connect to button-release-event.

I don't think so. I believe that the menus have the common dual
behaviour -- if you hold the button long enough, they only stay up as
long as it is pressed. If you release it quickly, they wait for another
click. That's why it needs to know the event time.

activate_time :      the time at which the activation event occurred.
The activate_time parameter should be the time stamp of the event that 
initiated the popup. If such an event is not available, use 
gtk_get_current_event_time() instead.

i don't really understand from where i should get that activation time..

Well, either use $event->time or Gtk2->get_current_event_time.

HTH,
-Torsten

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec <bulb ucw cz>

Attachment: signature.asc
Description: Digital signature



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