Hi all,
I know that there has been numerous queries on textboxes in this NG over
time and I did have a look at some of these using Google. However, I did not
find anything that seemed to solve my problem.
Scenario:
- C#
- CF SP2
- a number of TextBoxes on a form
- when form loads all textboxes filled with default text
- as user taps a textbox all of the text is selected and the caret is placed
at the end of the text
- tapping the ENTER key on the SIP moves the focus to the next textbox
- each time a textbox loses focus, a validation method is called to check
the input of that textbox
The problem:
With the SIP set for Letter Recognizer ready to write in text, it is
sometimes easy to mis-hit the ENTER key and a dot (period) removes the text
that was highlighted. Under these conditions, I would simply like to restore
the text back to what was previously showing.
Since the Letter Recognizer does not have immediate access to all the keys
on the SIP, I thought I would simply add a button called Undo on the form.
Theoretically, a tap on the Undo button would simply restore the text.
However, what I found was that the LostFocus method is called before the
Click method is called. Consequently, the LostFocus method fails on the bad
input before my Undo button click event can restore the original text.
Is there a way that in the LostFocus method that I can know which button was
tapped causing the LostFocus? If I could test in the LostFocus method that
it was my Undo button that was tapped that would be ideal. Or, is there a
better method?
BTW, I did try tapping Ctrl-Z when I re-selected the soft keyboard and the
textbox was in focus but nothing happened.
Regards,
Neville