PDA

View Full Version : Focus & Tab on MX2004 Components ...



TylerNZ
January 30th, 2004, 06:12 PM
Ok, I know you can do this with TEXT FIELDS ... but could someone tell me how to accomplish this with the component items!?

I've got a listener to listen for the reset button, so on the timeline I have this script:


clippy2Listener = new Object();
clippy2Listener.click = function (evt){
form.nameC.text = "";
form.emailC.text = "";
form.commentsC.text = "";
form.Selection.setFocus("nameC");
}
resetB.addEventListener("click", clippy2Listener);


The form does clear, so the code is working, however, the focus isn't setting.

Any ideas? And also with the tab indexing, can this be done with components.

THANKS TO ANYONE WHO CAN ANSWER!!! :thumb:

cmartin
January 30th, 2004, 06:25 PM
Just tested with the code below - it works...just removed the "form." from the Selection.setFocus(...). Also make sure that the instance of your Input Text Field is named correctly ("nameC"), otherwise the setFocus cant find it.


clippy2Listener = new Object();
clippy2Listener.click = function (evt){
form.nameC.text = "";
form.emailC.text = "";
form.commentsC.text = "";
Selection.setFocus("nameC");
}
resetB.addEventListener("click", clippy2Listener);


trace, trace, trace, trace, trace...

TylerNZ
January 30th, 2004, 09:55 PM
You're right, it does work on a "INPUT TEXT FIELD" ... but it DOESN'T work on a "TEXT INPUT COMPONENT".

kode
January 30th, 2004, 10:50 PM
Selection.setFocus(form.nameC);
??

TylerNZ
January 30th, 2004, 11:24 PM
Yep that works kode ... with the ""


Selection.setFocus("form.nameC");


Problem now is that it won't tab out of that box!

I managed to find the set index tab ... in the accessibility panel (Alt + F12). For anyone else having any issues. And there actually was some good help in the help section on setting tab indexes! :)

So, yeah, now I gotta figure out how to get it to tab out! :) Thanks Kode