How to determine if a method is called in subform

Usually I can tell if a method is running the context of a subform by testing the pointer returned by
<code 4D>
Object get pointer(Subform Container)
</code 4D>

If the pointer is nil the context is not a subform. This is no longer true in v17 under the following conditions:

  1. the subform container is an object (possibly a collection)
  2. the subform container’s dataSource is a reference to some other data object (eg. Form, ds or some other data)

I suspect the reason is because in this configuration you can’t modify the contents of the subform object directly (you would go modify the data it’s linked with instead). That’s fine. What I need to know is how to determine being in a subform without benefit of this trick?



Hi Vincent,
I like that. Compare to the width & height to the Window Rect. If they match it’s a form.

Probably - if the subform happens to fill the window the two dimensions could be the same. That’s a pretty rare case. “Why would you want to do that?”

Thanks for pointing out the new command also.