Hi,
In my app, I once needed to make a calling form disappear for the time of child form being active and reappear when that one was killed. So I wrote
IF TYPE("ParentForm")="O"
ParentForm.Hide
ENDIF
in the child form's Init, and then a similar one with "show" in its Destroy. And it worked like a charm.
Then, a couple of years later, I had to add another form, a "grandchild" one, being called from the child and running simultaneously. It could be closed manually or had to be closed automatically when its caller was closed (or it might not be called at all for some of sessions). So I updated child's Destroy with
IF TYPE("GrandChildForm")="O"
GrandChildForm.Release
ENDIF
...but this one refused to run. In the Debugger, when I'd type parent's name into the Watch window, it would open the list of form's property, but when I typed grandchild's (or child's as well, for that matter) name in a similar way, it'd answer "Expression could not be evaluated". I compared all forms's properties and DO FORM commands they are summoned by, but could not pinpoint a distinction between them that could explain the difference in behavior.
Now, the problem with my app I actually solved with a proper double-handshake procedure, where the caller and the recipient pass each other references to their own objects. It works, so I'm not asking for a solution. But curiosity does not leave me: why some forms can be called directly by name (I actually did the same thing in at least one other app without even being aware of possible problems), and other, existing and working perfectly in other regards, can't?
Thanks.
In my app, I once needed to make a calling form disappear for the time of child form being active and reappear when that one was killed. So I wrote
IF TYPE("ParentForm")="O"
ParentForm.Hide
ENDIF
in the child form's Init, and then a similar one with "show" in its Destroy. And it worked like a charm.
Then, a couple of years later, I had to add another form, a "grandchild" one, being called from the child and running simultaneously. It could be closed manually or had to be closed automatically when its caller was closed (or it might not be called at all for some of sessions). So I updated child's Destroy with
IF TYPE("GrandChildForm")="O"
GrandChildForm.Release
ENDIF
...but this one refused to run. In the Debugger, when I'd type parent's name into the Watch window, it would open the list of form's property, but when I typed grandchild's (or child's as well, for that matter) name in a similar way, it'd answer "Expression could not be evaluated". I compared all forms's properties and DO FORM commands they are summoned by, but could not pinpoint a distinction between them that could explain the difference in behavior.
Now, the problem with my app I actually solved with a proper double-handshake procedure, where the caller and the recipient pass each other references to their own objects. It works, so I'm not asking for a solution. But curiosity does not leave me: why some forms can be called directly by name (I actually did the same thing in at least one other app without even being aware of possible problems), and other, existing and working perfectly in other regards, can't?
Thanks.