The following Gtk::Entry never gets Gdk::Event::BUTTON2_PRESS:
class A < Gtk::Entry
def initialize
super
add_events Gdk::Event::BUTTON_PRESS_MASK
signal_connect 'button_press_event' do |widget, event|
select_range 0, -1 if event.event_type ==
Gdk::Event::BUTTON2_PRESS and event.button == 1
false
end
end
end
What am I doing wrong?
on 2012-03-20 14:55
on 2012-03-20 19:17
Le 20 mars 2012 14:54, Nikolai Weibull <now@bitwi.se> a crit : > end > _______________________________________________ > ruby-gnome2-devel-en mailing list > ruby-gnome2-devel-en@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ruby-... > Hi I tried signal_connect 'button_press_event' do |widget, event| p "ok" if Gdk::Event::Type::BUTTON2_PRESS==event.event_type false end and it works.
on 2012-03-21 10:41
On Tue, Mar 20, 2012 at 14:54, Nikolai Weibull <now@bitwi.se> wrote: > end > end > end > > What am I doing wrong? Here’s a complete example: require 'gtk2' e = Gtk::Entry.new e.signal_connect 'button_press_event' do |widget, event| p event.event_type e.select_range 0, -1 if event.event_type == Gdk::Event::BUTTON2_PRESS and event.button == 1 end d = Gtk::Dialog.new d.vbox.add e d.show_all Gtk.main All I seem to get is two instances of #<Gdk::Event::Type button-press>. This is on Windows, by the way, but that shouldn’t be relevant.
on 2012-03-21 11:09
Your example works for me as soon as I change "select_range" to "select_region". When I double click, I see: #<Gdk::Event::Type button-press> #<Gdk::Event::Type button-press> #<Gdk::Event::Type 2button-press> From: Nikolai Weibull <now@bitwi.se> To: Ruby-GNOME2 Developers <ruby-gnome2-devel-en@lists.sourceforge.net>, Date: 03/21/2012 05:41 AM Subject: Re: [ruby-gnome2-devel-en] Double-click in Gtk::Entry On Tue, Mar 20, 2012 at 14:54, Nikolai Weibull <now@bitwi.se> wrote: > end > end > end > > What am I doing wrong? Here’s a complete example: require 'gtk2' e = Gtk::Entry.new e.signal_connect 'button_press_event' do |widget, event| p event.event_type e.select_range 0, -1 if event.event_type == Gdk::Event::BUTTON2_PRESS and event.button == 1 end d = Gtk::Dialog.new d.vbox.add e d.show_all Gtk.main All I seem to get is two instances of #<Gdk::Event::Type button-press>. This is on Windows, by the way, but that shouldn’t be relevant.
on 2012-03-21 17:59
On Wed, Mar 21, 2012 at 11:08, <Raiford@labware.com> wrote: > Your example works for me as soon as I change "select_range" to > "select_region". When I double click, I see: > > #<Gdk::Event::Type button-press> > #<Gdk::Event::Type button-press> > #<Gdk::Event::Type 2button-press> I guess there’s a bug in Gdk for Windows in the version I’m running, then. That’s a bummer.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.