Log In    |    Knowledge Base    |    4D Home
Tech Tip: Listing objects in a form
Published On: December 16, 2004

A new command in 4D 2004 called GET FORM OBJECTS allows you to retrieve a list all or some of a form's objects. This command is especially powerful if you are planning on making the behavior and/or the appearance of your forms dynamic.

For example, given a list of form objects, you might want to hide or show some of them based on their name. You can do this by first retrieving a list of a form's objects using GET FORM OBJECTS as in the following:

GET FORM OBJECTS($objects;$variables;$pages)

Suppose that this line was placed in a form or object method. It would fill the $objects variable with all the names of the objects on that form, $variables with pointers to those objects' variables, and $pages would get the page that each object lies on. Alternatively, the optional asterisk (*) parameter retrieves objects on the current form page:

GET FORM OBJECTS($objects;$variables;$pages;*)

Now you have a list of object names, variable pointers, and the pages they reside on. You are now free to manipulate those objects however you please without ever knowing about those objects in advance.