Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:16 pm
by Torrie Moore >> Sun, 3 Feb 2008 20:35:53 GMT
Unfortunately there is no inverse to the form parent. The only way to get the parent is to enumerate through the open forms and query their parent.
vars
i : Integer;
oParent : Form;begin
oParent := what ever parent form you're interested in;
foreach i in 1 to app.formsCount do
if app.forms(i).getFormParent = oParentForm then
// This form is a child form of oParent
endif;
endforeach;
If you need to access the form's parent and children, then you could setup an inverse between the forms. We have created a common superclass form which has this defined. All our forms are subclasses of this common form. For example on the child form add a myParent reference inversed to a collection allChildren on the parent form. (You may need to create a collection of forms, e.g. FormArray or FormSet etc. There is a FormNameDict (see Locale::getForms) but this may not work if you open the same form twice.) You can then reimplement the setFormParent method to also set your reference.
setFormParent(form: Form) updating;
// Sets the form parent.begin
inheritMethod(form); // Let Jade do its stuff
myParentForm := form; // Also set the local reference
end;
Cheers
Torrie