Re: Gtk::HScale (Gtk::Range): Jump-to-position by left-click instead of middle-click?



2011-11-19 13:58, Phong Cao skrev:
Hello everybody,

I am new to Gtkmm. I am trying to develop a small music player using Gtkmm & GStreamermm. I use Gtk::HScale for the progress bar, which is responsible for updating the track progress & allow user to move to different time position in the track.

Everything works fine until now, except that I can not use left-click button to snap (or jump) to random position in the Gtk::HScale (Gtk::Range). Instead, I have to either drag or right-mouse-click. I have tried to solve this problem for several days and still can not figure out how to use left-click to jump to different position in the Gtk::HScale (Gtk::Range). I have searched through the GTK+ & Gtkmm mail archive & reference but found no place talking about this.

Does anybody here know how to implement this functionality for Gtk::HScale (Gtk::Range)? If so I hope you can give me a hint. 

Thank you and have a good day!

--
Phong V. Cao
I don't think it's possible to do what you want in a reasonably easy way. Which mouse button is used for which action is hard-coded in GTK+'s GtkRange widget. All programs are supposed to behave the same. A left mouse button click in the trough of a Range widget does not move the slider to the mouse, it moves the slider one page. You specify the page size in the associated Adjustment.

In principle you can connect to Gtk::Widget::signal_button_press_event() and Gtk::Widget::signal_button_release_event(), and handle mouse button presses the way you want, but I think it will require a lot of code.



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