Button focus

M

Mike

Can I trigger a button press event without putting focus
on the button? I am making a form full of buttons that
can be used as a keyboard on a touchscreen. If I have a
textbox which has focus and I click the 'Q' button on the
form which represents the 'Q' key on the keyboard,
nothing gets printed into the textbox because the textbox
loses focus. Any suggestions would be greatly
appreciated. Thanks for your reply.

Mike

ps. Any links to code samples of touchscreen C# programs
would also be greatly appreciated.
 
C

Champika Nirosh

cannot be ... not sure i got what you need correctly..

do you really need to have the focus to the text box inoder for you to add a
text to the text box..

Do you need to insert text as well??

Nirosh.
 
M

Mike

Its just an example. I might have several textboxes so I
want to be able to click a button which will insert text
in whatever textbox has focus...but the textbox will lose
focus so I won't know which textbox to insert the text
into. I hope that makes sense.
 
C

Champika Nirosh

Hi,

I think you have to keep a reference of the last activated text box and
force it to be focused before inserting the text.

here I think you can use mouse click of mouse up event..

Nirosh.
 
M

Morten Wennevik

Capture the killfocus event on the textboxes to track which one had the
focus
 
R

Ron McNulty

Hi Mark

This was a hard ask, even under standard C++/Delphi/Windows. The only
comprehensive solution was to install a CBT Windows hook that could truly
send keystroke events to anything in an application (including menus, modal
dialogs et al).

You may find this even more difficult to do under a managed framework.

Regards

Ron
 

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