Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

C# Focus Issues - Touch Screen - User Controls - Button Control - TextBox

28 views
Skip to first unread message

Anthony Gatlin

unread,
Dec 17, 2002, 6:17:26 PM12/17/02
to
I am developing a point-of-sale touch screen application. I am having severe
issues with focus between controls.

Some of the forms on the application have several textboxes for data entry.
To facilitate touch-screen data entry, I have created an alphabet user
control with 26 buttons. When a user presses a button, I want for the
application to add the alphabetic character to the textbox which had focus
when the button control was pressed.

My problem is that I don't know how to determine which control (specifically
which textbox control) had focus before a button on my alphabet user control
was pressed. I need to know this information I think to return the text (and
perhaps the focus) back to that (textbox) control.

I would like to get around having to rewire the LostFocus event on every
textbox control. I prefer a solution that is generic that can be easily
added to work with all my forms.

I would also like to prevent the button controls on my alphabet user control
from gaining focus.

Please help! Thank you very much!

Please feel free to email me at aga...@nospam.brainride.com. (Remove the
nospam.)

Regards,

Anthony Gatlin


Craig S

unread,
Dec 17, 2002, 8:38:29 PM12/17/02
to
Maybe not the answer you want, but the way I would go about it would be
this.

1. Declare a string variable at the class scope named 'strFocusedTextbox'
2. on each textbox's GotFocus event, write the name of that textbox in the
'strFocusedTextbox' variable
3. Then when the user clicks on the buttons to insert text, the code would
be the same for all of them, just append text to the textbox who's name is
stored in strFocusedTextbox.

I suppose an implementation you mentioned on LostFocus would be similar, but
Gotfocus seems to make more sense to me. Either way, it's the most
straight-forward way I can think of to reliably do that.

Hope this helped,
Craig


"Anthony Gatlin" <car...@brainride.com> wrote in message
news:uoicncsAzrB...@comcast.com...

0 new messages