I’m not sure if onElementFocusGained is supposed to be fired on labels but as long as it is a form event I assumed that it is.
Well, it’s not in my solution. I was wondering if it’s a bug or not. Because I want it to fire on any element of the form which gains focus.
Thank you!
Cheers,
Maria
P.S. A sample solution with the failing event is attached just in case. Click on the textfield - console comes up with a mesage. Click on the label next to it - nothing happens.
jcompagner:
only fields do get focus events, labels don’t get focus.
Also in the designer you don’t have the focus events on a label, only on fields.
True, but in designer we can use onAction on a label.
See, my problem is this: we have multiple windows in our application and I keep track of each window’s data environment. When changes happen to data I must know exactly in which window they are happening.
This is why I need to have a base method in the base form from which everything else is inheriting, that will always keep track of the active window. That is, when I’m changing the data in window ‘A’ and then click on a ‘search’ label, for example, in window ‘B’, I need a way of knowing it happened and switch the active window variable to the appropriate window. I did it in onRecordEditStart (before it came to labels) and it worked well until I found myself in a scenario where no data change happens on a label click but later in the code I need to have switched the active window to the one with that label and it didn’t happen because onRecordEditStart hasn’t fired and onElementFocusGained doesn’t work on labels.
Perhaps it’s a little complicated, but anyway, is there a chance that onElementFocusGained will be working on other elements than fields?
Otherwise, how do I determine the moment another window got focus?
maria:
See, my problem is this: we have multiple windows in our application and I keep track of each window’s data environment. When changes happen to data I must know exactly in which window they are happening.
I am writing this from my iPhone so I have to be short.
If I were you, I used a global such as
var windowsenvironment = “”;
I’d then use this to identify the base form (by the form name perhaps). The global could be set on show form property - maybe.
maria:
True, but in designer we can use onAction on a label.
and on action is not onfocus so what are you trying to say?
maria:
See, my problem is this: we have multiple windows in our application and I keep track of each window’s data environment. When changes happen to data I must know exactly in which window they are happening.
This is why I need to have a base method in the base form from which everything else is inheriting, that will always keep track of the active window. That is, when I’m changing the data in window ‘A’ and then click on a ‘search’ label, for example, in window ‘B’, I need a way of knowing it happened and switch the active window variable to the appropriate window. I did it in onRecordEditStart (before it came to labels) and it worked well until I found myself in a scenario where no data change happens on a label click but later in the code I need to have switched the active window to the one with that label and it didn’t happen because onRecordEditStart hasn’t fired and onElementFocusGained doesn’t work on labels.
Perhaps it’s a little complicated, but anyway, is there a chance that onElementFocusGained will be working on other elements than fields?
Otherwise, how do I determine the moment another window got focus?
Not everything will get focus. But i my eyes you are trying to do the wrong thing
If you want to have the real scope at the moment of some datachange, then you should just get the real scope at the moment of that data change, don’t depend on focus stuff for that
maria:
See, my problem is this: we have multiple windows in our application and I keep track of each window’s data environment. When changes happen to data I must know exactly in which window they are happening.
I am writing this from my iPhone so I have to be short.
If I were you, I used a global such as
var windowsenvironment = “”;
I’d then use this to identify the base form (by the form name perhaps). The global could be set on show form property - maybe.
Hope this help. Best, Carlos
This will not work, Carlos. The form is shown, then another window is shown and when the user goes back to the first form it will not run onShow again.
maria:
True, but in designer we can use onAction on a label.
and on action is not onfocus so what are you trying to say?
maria:
See, my problem is this: we have multiple windows in our application and I keep track of each window’s data environment. When changes happen to data I must know exactly in which window they are happening.
This is why I need to have a base method in the base form from which everything else is inheriting, that will always keep track of the active window. That is, when I’m changing the data in window ‘A’ and then click on a ‘search’ label, for example, in window ‘B’, I need a way of knowing it happened and switch the active window variable to the appropriate window. I did it in onRecordEditStart (before it came to labels) and it worked well until I found myself in a scenario where no data change happens on a label click but later in the code I need to have switched the active window to the one with that label and it didn’t happen because onRecordEditStart hasn’t fired and onElementFocusGained doesn’t work on labels.
Perhaps it’s a little complicated, but anyway, is there a chance that onElementFocusGained will be working on other elements than fields?
Otherwise, how do I determine the moment another window got focus?
Not everything will get focus. But i my eyes you are trying to do the wrong thing
If you want to have the real scope at the moment of some datachange, then you should just get the real scope at the moment of that data change, don’t depend on focus stuff for that