[Gambas-devel] Events

Rob sourceforge-raindog2 at ...19...
Fri Sep 15 17:04:23 CEST 2006


On Friday 15 September 2006 10:19, Scott, Vince wrote:
> Can you send keyboard events in Gambas like you can with VB's
> Sendkey? Also, can you send events to a combo box to make it
> dropdown without using a mouse. I am working on a touch screen
> application in which no keyboard or mouse will be used...I
> need to send keyboard events via code.

Under Linux, the touchscreen is usually handled as a mouse.  
That's how tablets work, like the one I'm typing this on.  
There's a "wacom" module, and maybe an X11 driver, that takes 
touchscreen input and converts it to mouse movements and clicks.  
But I don't know whether that helps you in this situation.

Gambas has no SendKeys equivalent; that was one of the first 
things I mentioned on the original help wiki's "Differences from 
VB" page.  At the time, I was also looking for a way to send F4 
to a combo box to make it drop down.  I never did find one.

Qt's QComboBox widget (which ComboBox is based on) does have a 
popup() method which it should be pretty easy to expose in 
Gambas.  Gtk's combo box has an identical method, so there 
should be no concerns in adding that.  I'll see if I can build 
the latest Gambas2 this weekend and submit a patch.

As for SendKeys itself, I'm not sure whether or not it's possible 
in Qt or Gtk to do that, if it's something you can even do at 
the toolkit level.  I'm not even sure how it works under 
Windows, since it works even if you have other applications 
focused (which was when I mostly used it.)  Maybe there's a way 
to inject keyboard events into some global X11 queue, I don't 
know.  I'm pretty sure they must have done it in VB at a lower 
level than MFC.  In any case, it sure would be useful to have.

Rob




More information about the Devel mailing list