SetFocus in VL Web dialog

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

SetFocus in VL Web dialog

Post by adale »

I have a VL Web (epc 150040) Dialog with an input field that I want ready for input without having to click on it, or press tab to get the focus.

For the field, I have the TabPostion = 1, and TabStop = checked, and the Method Routine which presents the dialog (#com_owner.show) I have:

#edInput.SetFocus

If I click on the field it gets the focus. Or if I press the tab key, it will get the focus. How can I have this input field ready to accept input without any other user intervention?
Arlyn Dale
Servias LLC
adale
Posts: 212
Joined: Wed Apr 08, 2020 9:18 pm
Location: Poplarville, MS

Re: SetFocus in VL Web dialog

Post by adale »

Per support:
Checking the archives and it looks like this issue was reported couple of years ago. This is LPC observation.

"The reason for the bug is that the popup window is faded and scaled into view, and this processing is not completed when the Show method is executed. After the fade/scale completes, it reassigns focus to the first tab position, rather than the position that you had used SetFocus with."

LPC has suggested a workaround for this.

You will have to turn off fade/scale in dialog by having BEGIN_COM definition like this.

Begin_Com Role(*EXTENDS #PRIM_DLG) Height(257) Layoutmanager(#Layout) Autofocus(True) Transition(None)


** P1M__Dialog
* SetFocus will not work in a dialog with default dialog transition property of FadeIn.
* To use the SetFocus, set the input field to Tab position = 1, TabStop = True, and
* in the dialog BEGIN_COM Role - Autofocus(True) Transition(None)
Arlyn Dale
Servias LLC
Post Reply