Hi,
Is there a way to find out in which field the cursor is (tabseq #) ?
I use a masterform with tabpanels containing the real forms and fields.
If the user switches tabpanels i want to put the cursor on the first field of the form
if this is the first time he enters the tabpanel.
When he leaves the tabbpanel i want to save the tabseq# and put the cursor
back into that field if he returns to that tabpanel.
Regards,
Hi Hans,
This is Servoy 4 ? If so you could use a form global to keep the fieldname in it that is set via an onFocusGained event on the fields.
This way you could put the focus back to it when the onShow is hit again.
Hope this helps.
Hi Robert,
It is 3.5.6.
But i just found a way to do it and tested it.
Like you suggested. But since i could not use a form global variable i used
a forms[_form].active_field. So i extended the form with my own variable.
Then i use a onFocusGained method to set this form variable and in
the onTabChange i check if it is set and then set focus to that field.
Works fine !!
The onTabChange code =
_form=application.getMethodTriggerFormName()
if( forms[_form].elements.tabs)
{
var _current = forms[_form].elements.tabs.tabIndex;
var _formName = forms[_form].elements.tabs.getTabFormNameAt(_current)
}
else
{
_formName=_form
}
if(!forms[_formName].act_field)
{
forms[_formName].controller.focusFirstField()
}
else
{
forms[_formName].elements[forms[_formName].act_field].requestFocus()
}
The onFocusGained code =
forms[application.getMethodTriggerFormName()].act_field=application.getMethodTriggerElementName()
Thanks anyway, always good to get feedback from expirienced users.
Regards,