rhh 29 posts since
Oct 12, 2007
1.
Re: How can the sub-contol know the exact type of the parent ? Nov 5, 2007 3:36 PM
Generally it's better not to build an application where the operation of a control depends on the type of its parent container, because it causes different operation in situations that are visually indistinguishable, such as when you put a control in a Frame that is in turn a child of a parent container, so that options or margins can be set on the Frame. But if you do start with a graphical object g and you navigate to its parent object using an expression such as g.parent, you can determine the run-time type of the parent by using the expression
{type-of g.parent}
You may also want to use the "isa" operator to ask whether the object has a specific type that you're interested in, or the type-switch operator to dispatch to several different handlers depending on the type of the object.
-Bert