$menu->popup -- position callback doesn't work



i'm trying to generate a ui similar to the gimp, with a button in the upper-left-hand corner that pops up a menu on a button press event.

   $menu->popup ( undef, undef, $event->{button}, $event->{time} );

works, but the menu comes up under the pointer; if the user does a normal click on the menu button, the menu pops up and immediately the top menu item activates and the menu goes away -- quite disorienting. in the gimp, they solve that by using a menu position callback that moves the menu to right of the button, so it pops up *not* under the pointer and sticks around.

however,

  $menu->popup ( undef, undef, $event->{button}, $event->{time},
                 sub { ...something returning two ints... } );

doesn't work ---- the callback gets called, but the menu never appears.

without the menupos function, it pops up, with the menupos function, nothing. the main window unfocuses as though there is a menu, but i see nothing.

this is quite bizarre.  what's wrong?

 libgtk+1.2-1.2.10-25mdk
 perl-GTK-0.7008-15mdk



p.s.: i resorted to XS and the menupos function works fine. i even was able to use an ItemFactory with the top widget set to a Gtk::Menu and get free accelerators and submenus. the nasty part was copying the typemap code to extract the widget pointer. blech.

an interesting side note is that with the top menu item being the root of a submenu, the menu doesn't disappear immediately when clicking and releasing (without the menupos function).






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