Re: [gtk-list] Button clickable with all 3 mouse buttons? How?



Oliver Freyd <freyd@uni-muenster.de> writes:
> While coding on my  graphics program, I've seen that programs like xfig
> use some buttons with different actions when you press with moue button
> 1,2 or 3. In GTK you can only use Button 1, the other buttons don't react.
> 
> I don't know if this  limitation is too good, 
> one could just omit it, so all 3 buttons would  be sensitive.
> Or I'd have  to catch the button_pressed_event and button_released_event and
> change the button number on the fly or something,
> I'm not really sure ...

button_(press|release)_event is the right choice for this. This should
only be used for things like drawingarea or other things that need low
level access - button_press_event is low level thing and using it
elsewhere might make your application act differently from other gtk
applications.

> BTW, I'm using gtk--, so I could inherit a normal Gtk_Button and catch the
> signal before the Button gets them...

Hmm, you're using it for Gtk_Button's? what exactly are you trying to
do? Is there some reason normal buttons dont work with it? Binding a
button click of other mouse buttons atop of a button to mean different
thing is a bad thing (I wouldnt want to use app like that - it might
become new xfig with completely horrible user interface :)
(only use for that I could imagine is to assign a different menu atop of
each Gtk_Button... but... I dont know if thats a good idea either..)

Yes, if you really really want to do this, then inheriting from Gtk_Button
and overriding the button_press_event_impl() -method will do it.

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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