I have a Form Show Event requiring inital focus on a particular element (table view).
In the Show event this works properly if it is the only line of code in the Form Method:
elements.fld_service_object.requestFocus();
If I add one line of code (set visibility of another element) before this line of code my original line of code fails:
elements.fld_service_provider.visible = false;
elements.fld_service_object.requestFocus();
Any ideas what I am doing wrong?
Michael
Please report this issue in the Servoy Support System.
In the mean while you can use:
elements.fld_service_provider.visible = false;
application.sleep(200)
elements.fld_service_object.requestFocus();
I’ve had this issue also with requestFocus on an onLoad event whereby the rest of the script works ok but the requestFocus part does not…
No work around found thus far.
Sanneke,
The workaround works fine. The good news is that only the most coffee-wired individuals in our office will miss 200 ms .
Submitted to Support System.
Thanks
M^2
IT2Be
June 27, 2007, 5:34pm
5
Dexadrine:
requestFocus on an onLoad
Why do you do this onLoad. That doesn’t make sense, I think this should be done onShow like michael does.
Sanneke,
Also noted that the 200ms delay doesn’t work in all cases. If Servoy is loaded or has been loaded recently, the 200ms delay will work almost always.
However, if the dev machine has been more busy with other tasks and is slower bringing the Solution on stream then it will also fail:
Servoy open - in design mode
Run some other stuff that is memory/cpu intensive
Click back on Servoy (win 32 - win xp)
Click on the icon to move from Design Mode to Run Mode
Form event will also fail as the 200ms delay is “not enough” to allow other processes/threads to catch up
Support case 83631
Michael
If getting the focus is more important than a little waiting time, than you can increase the number of ms, but you have to decide that yourself
I have the opposite problem. I do not want the first text field to gain focus. I don’t know why it gains focus…
How can I avoid the focus to be given to the field?
IT2Be
July 4, 2007, 10:00am
9
You can remove the field from the tab Sequence in the tabSeq property the in the properties bar…