Re: right-click on CheckButton



* Nori Heikkinen <nori+gtk-perl maenad net>:

i'm writing a little to-do list program for myself (and, as it always
works out, spending way too much time writing a program to make a list
of things i _really_ should be doing :-P).  i'm using CheckButtons for
each item, and i'd like to be able to open up a little pop-up menu if
one is right-clicked on.  is this functionality there somehow?

You may use the 'button-press-event', and then check if the button code
is 3:

        $check->signal_connect(button_press_event => sub {
                        my ($check, $event) = @_;

                        if (3 eq $event->button)
                        {
                                # do your stuff...
                                
                                # block event propagation
                                return TRUE;
                        }
                        
                        # let the event chain proceed
                        FALSE;
                });

[completely untested code, but should work AFAIR...]

Regards,
 Emmanuele.

-- 
Emmanuele Bassi (Zefram)                 [ http://www.emmanuelebassi.net ]
GnuPG Key fingerprint = 4DD0 C90D 4070 F071 5738  08BD 8ECC DB8F A432 0FF4



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