Button focus

  • Thread starter Thread starter Mike
  • Start date Start date
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.
 
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.
 
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.
 
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.
 
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
 
Back
Top