Hi,
I have a following situation:
I have a form that is shown in dialog
On this form I show records in a tableview and I have a field with a onFocusLost method.
In the onFocusLost I check if some value is zero and it is the last record in the foundset, then the dialog is closed.
If it is not the last record in the foundset, I go to the next record.
I have also a ‘Close’ button in the footer part of the form.
When pressing the ‘Close’ button the form dialog must be closed immediately.
What happens:
I have 2 records.
When the first record is selected and I press the Close button, the onFocusLost() method is executed and not the onAction of the button.
So what happens is that the next record is selected in stead of closing the dialog.
Within the onFocusLost() I don’t see any possiblity to see if the the focus was lost because of pressing a button.
The application.getMethodTriggerElementName() shows the name of the field and not the name of the button.
How can I succeed that the onAction of the button passes before the onFocusLost of the field?
Martin
martinh:
How can I succeed that the onAction of the button passes before the onFocusLost of the field?
You can’t since the button requests focus and focusLost is therefore always processed first on the field.
Consider changing from focuslost to datachange event
Consider changing from focuslost to datachange event
The datachange event is not triggered when the data doesn’t change, so that would not help also.
And my customer wants to use ENTER on numeric pad as Next Field, so the onAction is also not possible.
Looks like I’m blocked?
But are you saying that even the onFocusLost is triggered on the field. Te onAction never comes along? That sounds strange. Both methods should be triggered.
Hi Johan,
Unfortunately the onAction is not triggered. It would be very appreciated if it would, because onFocusLost is not always the correct trigger
Create a form with a field
Put both onAction and onFocusLost method behind a field (just put application.output(‘on…’) in the method
onLoad put the following:
application.setNumpadEnterAsFocusNextEnabled(true);
And you’ll see that the onFocusLost is triggered and not the onAction when using Enter on numpad
Martin
Now you are suddenly saying a complete other thing. Now you have an onAction and onFocus on only the field.
In the first post you described an onFocus on the field and onAction on a button… So what are you now trying to do?
Please make a sample and create a case.
That is indeed another situation, but both cases are related.
In the case with onFocusLost on field and onAction on button, the problem is that the onFocusLost is doing some action that causes the onAction on the button not to execute.
Jan Blok already replied that there is no solution for that.
If there would be an onAction that is being executed also when Enter on numpad is pressed, then this would also solve a big part of my problem.
Or a new method (onNextField), which is executed when stepping into a new field. That is not equal to onFocusLost!