I have been trying to work with the onElementFocusLost event in Servoy 6.0.3
I set a method to the onElementFocusLost event of a form. However, this event occurs even when I click on the form itself. Then, I tried setting this method to the onElementFocusLost event of an element in the form. However, even when I click on this particular element, the event gets triggered.
Maybe I should explain what I want to achieve
I have two tab panels, placed one next to the other, on a form (lets say frm_main). There are two separate forms (frm_1 and frm_2) on these tab panels. I need to know, given a particular instance, which form the user is clicking. I am using the event.getFormName() method, however that’s when the issue of which event to use occurs. Any thoughts?
That can get pretty complicated. Because you would have to catch all click events for all elements on each form to determine which one is being clicked on. If each form just has one button and you want to know on which form the button is being clicked then it’s easy enough. But what happens if no mouse is used and the user tabs through the elements with the keyboard?
Of course you could decide to use one tabpanel and switch between the forms and the tabpanel will know which one is active. But if they are both active what’s the point of keeping track of focus?
If you really need this you could try using each forms onElementFocusGained event which will trigger each time a element (not for buttons though) gets the focus and set a global propert with the active formname but remember that events like that get fired a lot which can be bad for performance.