Hiding and showing objects is an effective way of increasing the flexibility and usability of a form. You can use a form with several objects that appear and disappear as the basis to provide different functionality from the same form. This approach can save you from creating too many different forms. The challenge is how to manage the objects that need to be hidden and shown without forgetting to incorporate new ones as you create them or edit them in a form. The following is a possible solution that only requires that you keep a level of consistency in the nomenclature you use to identify your objects:
Name your objects with a prefix that identifies the type of object. For example:
var_ for variables
button_ for buttons
label_ for text labels
border_ for borders
and so on... Keep in mind these are the Object Names. To use a routine that would hide certain objects, all you have to do is add another prefix to those objects you want to hide. The prefix can be either _showhide_ or more specific like _showhide_stage1_. For example:
Now all you have to do is to create a routine that uses those prefixes as the basis for what objects to show and hide. One important thing to remember, use the @ character to cover all the Objects you want to show or hide regardless of their names. As long as they start with the same prefix, it will work.
|`Routine to hide objects|
|`Routine to show objects|
If you create new Objects or edit the current ones, just remember to name them appropriately and the routine will always perform with any number of objects.