My framework uses a toplevel form instead of _SCREEN. When the toplevel form is activated, _SCREEN.ActiveForm returns the correct object reference to the toplevel form.
The same holds true with other modeless child forms which are activated on top of the toplevel form
and when I shift focus between these child forms (firing the form's Activate event), _SCREEN.ActiveForm will always return the correct active form's object reference.
The problem occurs when I shift focus back to the toplevel form after a child form has been activated. _SCREEN.ActiveForm will always return the reference to the last child form activated even after the toplevel form's Activate event has fired and now has focus.
Since I need a reference to the current active form, my solution is the following code in Activate event of the form base class:
IF VARTYPE(goApp) = "O" AND NOT goApp.oActiveForm = This
goApp.oActiveForm = This
ENDIF
If anyone has a more elegant solution (or if I'm missing something) please let me know.
- Jeff