[Gambas-user] probably unreasonable requests
Rob
sourceforge-raindog2 at ...94...
Thu Jul 10 00:04:27 CEST 2003
On Wednesday 09 July 2003 17:19, Benoit Minisini wrote:
> Declare the KeyPress event handler as a function that returns a boolean,
> and then returns TRUE to cancel the event propagation.
Thanks! I added a line to the event declaration page on the wiki to make this
more obvious. It works like a champ.
> > (c) in combination with (b), is it possible for a form to receive events
> > before its child controls do? I know Qt has the concept of an event
> > filter but I don't know how it would fit into Gambas' Qt component.
> No. What for ?
For example, I expect to be working on a program (re-implementation of a VB
app) that makes an SSH connection to a remote machine (using a Process
object), and lets you interact with the process on the remote machine.
Rather than using the method in the example terminal applet where you have a
textbox for the user's input, I'd like to catch keypress events as they
happen and forward them to the ssh process, like in konsole or any other
terminal emulator. VB has the "KeyPreview" property on forms which causes
this to happen when set to true. I have done this in other
languages/toolkits by making a transparent label that accepted keypress
events and placing it over the output widget. Gambas labels seem to be
opaque currently though, and at any rate it's not an ideal solution (e.g. you
can't select text on the underlying output widget.)
However, I see now that I can use the method from your response to (b) to get
around this pretty easily, and the use of the "event group" feature should
take care of most other applications that use the VB KeyPreview form
property. Other VB programmers have asked me about it, though, so I'll have
to revisit this after a few months to see if I've run into any cases where
this method wouldn't work.
Rob
More information about the User
mailing list