Re: Trouble attaching signal to items in a submenu



On Tuesday, March 2, 2004, at 05:44 PM, Lee Aylward wrote:

I just noticed that it _does_ work if I actually _click_ the submenu and then click on the submenu item. It does not work if I just hover over the submenu and then click the submenu item.

Is there any way around this?

sounds like your menu is not tracking properly.

  $button->signal_connect(released => \&menu_show);
  ...
  sub menu_show
  {
          $menu->popup(undef, undef, undef, undef, $menu,0);
  }

you're passing an invalid value for the fifth argument to popup -- it should be a button number. the sixth parameter is the time to start tracking; you've passed "now".

the "released" handler will actually get two arguments, the button and the click event; the event knows which button was pressed and when it was pressed. so, what happens if you instead use

  sub menu_show
  {
          my (undef, $event) = @_;
$menu->popup(undef, undef, undef, undef, $event->button, $event->time);
  }

?


(i'm not in a position to test that out atm)

--
"that's it! you're a genius!" "yes. that's what i think. do you think i deserve a raise?"
        - dialogue from 'Godzilla versus Mothra', 1964




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