Anyone know what's the matter with this code to automate a button click? def make_event_button(window, x, y, button, type) case type when :press event_button = Gdk::EventButton.new(Gdk::Event::BUTTON_PRESS) when :release event_button = Gdk::EventButton.new(Gdk::Event::BUTTON_RELEASE) end event_button.x = x event_button.y = y event_button.button = button event_button.time = Gdk::Event::CURRENT_TIME event_button.window = window event_button end def left_click_on(widget) make_event_button(widget.window, 0, 0, 1, :press).put make_event_button(widget.window, 0, 0, 1, :release).put end left_click_on(gtk_button) # --end thanks Dan ____________________________________ Daniel Benjamin Lucraft www.daniellucraft.com/blog twitter.com/danlucraft
on 2009-04-23 21:18
on 2009-04-24 00:05
am Thu, 23 Apr 2009 20:17:04 +0100, tat Daniel Lucraft <email@example.com> der Welt kund: > Anyone know what's the matter with this code to automate a button click? > Hi, I don't know, whats wrong with your code, but if you only want to simulate a button click, why not simply use Gtk::button.activate? Cheers, detlef -- http://det.cable.nu
on 2009-04-24 10:05
Yes, thanks for the tip. I'd prefer to create click events because I am trying to simluate user input as closely as possible for my features. Code that simulates a click can be used everywhere, not just on a button widget. I tried the activate option anyway (I'll try anything at this point) but ran into problems. It works on standard buttons, but for some reason when I call 'activate' on a button in a (non-modal) FileChooserDialog, the dialog will hang with the button depressed. I've not been able to figure out why this is. The stranger part is that it doesn't just hang my application, but in fact hangs the event loops for ALL applications I have open. I can just about tell Ubuntu to forcibly close my app, which brings everything else back to life, thankfully. But my app is dead to the world. What strange spirits have I angered, please? Dan ____________________________________ Daniel Benjamin Lucraft www.daniellucraft.com/blog twitter.com/danlucraft 2009/4/23 Detlef Reichl <firstname.lastname@example.org>:
on 2009-04-24 11:26
Cant you use this: .signal_emit(:clicked) To trigger a signal?