Re: [VDKBuilder]Handling keypress events in a form
Brought to you by:
gertwin
|
From: Tim L. <ti...@lo...> - 2001-04-30 18:22:42
|
Hi Mike, On Mon, Apr 30, 2001 at 11:47:16AM -0400, Michael Wagner wrote: > Hi! > > Sorry for the newbie question, but how can I use VDK to handle a key > press in a form? I can't seem to follow the documentation as far as this > is concerned. If someone could point me to the relevant classes or > (better yet) example code, I'd appreciate it. First of all there are two different signal APIs in VDK, the "native" one and another one using libsigc++. Using the native one (i guess the one in you mind) it works as follows: Your callback-method must have a signature of type: bool OnKeyPress(VDKObject*, GdkEvent*) as usual and then connect to the event with the name of key_press_event, e.g.*): DEFINE_EVENT_MAP(...) ON_EVENT(receiver,key_press_event,OnKeyPress) END_EVENT_MAP(...) The delivered GdkEvent* will hold the information you want, like event->state, event->string, event->keyval and so on. If you compiled VDK with --enable-sigc=yes (adds the signal-meachanism on top of libsigc++), you just need to connect to the OnKeyEvent-Signal with an argument of KE_RELEASE. You can find an example of this in the sigcvdktest-directory. Look at the file eventtestbox.cc (in the method kr_connect). There should have come a file named sigc.ps with vdk where the API is explained in more detail (i know, documentation about this is quite bad now). HTH Tim *) as described in vdkrefmanual.ps; for further examples look in vdktest-code. |