This is the mail archive of the guile-gtk@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Right mouse click on buttons?


"Greg J. Badros" <gjb@cs.washington.edu> writes:

> Anybody know how to make GTk+ generate a signal on a right-mouse
> click on a button (or a button-bar)?

Try the "button_press_event" signal, like so

    (use-modules (gtk gtk)
                 (gtk gdk))

    (let ((w (gtk-window-new 'toplevel))
          (b (gtk-button-new-with-label "Click Me Right!")))
      (gtk-container-add w b)
      (gtk-signal-connect b "button_press_event" 
                          (lambda (ev)
                            (cond
                             ((= (gdk-event-button ev) 3)
                              (display "Yes!\n")
                              #t)
                             (else
                              #f))))
      (gtk-widget-show-all w)
      (gtk-standalone-main w))

- Marius

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]