Button controls and onKeyPress events.

  • Thread starter Kyle Prestenback
  • Start date
K

Kyle Prestenback

I am having trouble using the button control (and
possibly other controls) simultainiously with the
onKeyPress event (onKeyDown and OnKeyUp). The onKey
events are used to get the key presses from the toggle
and the center keypad on the Pocket PC. Right now, they
work fine until I press a button on which would trigger
any button's on click event. The onclick event
processses, and the rest of the application continues to
function, but the OnKey events no longer seem to respond.

Help?

Kyle
 
A

Alex Feinman [MVP]

Clicking the button removes focus from whatever control had it and puts it
on the button. You might try to set explictly focus to your other control on
the button Click handler. If that does not work, try doing it on timer,
launching the timer for just a single shot from the Click handler with a
short interval, like 100 ms
 
D

David So [MSFT]

Kyle,

Alex is correct, activating any control will get focus on that control and
the focus will no long on the form (or other controls), you can put the
focus back on the form like

this.Focus();

when ever you are executing an event handler code, that way it should
enable your other event handler (OnKeyDown, OnKeyUp) to be executed.

Thanks,

David
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Alex Feinman [MVP]" <[email protected]>
| References: <[email protected]>
| Subject: Re: Button controls and onKeyPress events.
| Date: Mon, 3 Nov 2003 17:35:51 -0800
| Lines: 23
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: 204.249.181.133
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:37627
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Clicking the button removes focus from whatever control had it and puts it
| on the button. You might try to set explictly focus to your other control
on
| the button Click handler. If that does not work, try doing it on timer,
| launching the timer for just a single shot from the Click handler with a
| short interval, like 100 ms
|
| | > I am having trouble using the button control (and
| > possibly other controls) simultainiously with the
| > onKeyPress event (onKeyDown and OnKeyUp). The onKey
| > events are used to get the key presses from the toggle
| > and the center keypad on the Pocket PC. Right now, they
| > work fine until I press a button on which would trigger
| > any button's on click event. The onclick event
| > processses, and the rest of the application continues to
| > function, but the OnKey events no longer seem to respond.
| >
| > Help?
| >
| > Kyle
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top