Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On screen Keyboard

Status
Not open for further replies.

trenete

Technical User
Mar 1, 2004
1
CA
Hi.. i was trying to make an onscreen keyboard.. but had a problem on directing my input to where the focus is

bascailly i have 2 input fields.. and i want the input to go to where the focus is currently at..

can anyone pls help me out?
 
I noticed this post was done on the 1st but just in case you still need help ...

I did something similar to what you're doing and what I did was set up a variable to save the current focus then use the onSetFocus function on each of your text fields to set a new value for the variable e.g.

//Set initial variable value (initial focus)
var FocusedField = textField02_txt;

//When focus is on field set new variable value
textField01_txt.onSetFocus = function () {
FocusedField = textField01_txt;
};

Then on pressing the button to insert a character do something like this:

button_btn.onRelease = function () {

//Send the focus back to the last focused text field
Selection.setFocus(FocusedField);

//Show the caret at the end of the text
Selection.setSelection(FocusedField.length,FocusedField.length);

//Add character to end of text
FocusedField.text = FocusedField.text + "a";

//Show the caret at the end of the text
Selection.setSelection(FocusedField.length,FocusedField.length);
};

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top