PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

SIP problem

Hello,

I'm using the SIP panel for text input in my application. When I start the application and open the SIP panel en press any key, the OnKeyDown event is fired. But when I first had moved or pressed with the stylus on the screen and open the SIP panel, this event isn't fired anymore. How could I force the pocket pc to fire the event regardless of the current focus?

thx!

Maarten
I've read your post a few times now, and I still don't understand exactly what is happening. Can you go into more detail?

Dan East
ah! this sounds similar to the behaviour of normal windows applications. When there is a control on the dialog/window, then onKeyDown is not fired anymore to the main window but to the control instead. It is then impossible to remove the focus of the controls and back to the main window, the focus always keeps to one of the controls on the window.

So you should tap into the key events which are posted to your control. With MFC this is done by subclassing the control with your own specific eventhandlers. In bare windows I'm not entirely sure.

Another, but less nice solution, is to install a hook which listens to all keys, no matter which window/control has focus. This solution is only sensible if you want to listen to keys even if your app doesn't have focus.

R
See NM_KEYDOWN. Some types of controls will not send notifications of certain key events. Also the dialog will absorb some key events, like VK_TAB, so the control never sees them in the first place.

Dan East
I've read your post a few times now, and I still don't understand exactly what is happening. Can you go into more detail?


I want text input in my pocket pc application, but I don't want to use a textbox. I use the small keyboard which fires a keydown event. The problem now is that when I first had tapped on the screen and then use the keyboard, this event isn't fired anymore.
Try calling SetFocus on your window handle when you get a keydown event. If that doesn't work then try SetForegroundWindow. Windows CE dialog boxes must have some mechanism that automatically takes input focus back from the SIP.

Dan East
Are you specifying the HWND of your main window when you display the SIP? For example SHSipPreference(hWnd, SIP_UP) instead of SHSipPreference(NULL, SIP_UP).

Dan East
My application is a form which is derived from Form:

public class Form1 : System.Windows.Forms.Form
{
}

and is start up like this:

static void Main()
{
Application.Run(new Form1());
}

I don't need to call a function to open the SIP panel, there is a keyboard icon in the toolbar which can enable the panel.

I think I have to force in some way that the panel has focus when it's enabled as a result of which it will fire the keydown event when a key is pressed.

Maarten