KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Show visibility of objects selectively on a form
PRODUCT: 4D | VERSION: 14.1 | PLATFORM: Mac & Win
Published On: August 11, 2014

Using the OBJECT SET VISIBLE command allows objects on a form to be visible/invisible. The following code below takes in an pointer to a array for selective objects names to control the visibility:

// ------------------------------------------------------------------
// Name: set_objects_visibility
// Description: Takes a pointer to an array to set the visiblity of
// objects.
//
// Input Parameters:
// $1 (POINTER) - Pointer to an array of object names (in text)
// $2 (BOOLEAN) - True - Visible, False - Not Visible
// ------------------------------------------------------------------
C_LONGINT($i)
C_POINTER($1;$arr)
C_BOOLEAN($2;$choice)
$arr:=$1
$choice:=$2

if (Count parameters>1)
   For ($i;1;Size of array($arr->))
      OBJECT SET VISIBLE(*;$arr->{$i};$choice)
   End for
End if



Here is a example to control visibility of a "Button" and "Combo Box" where the array entry is the "Object Name" :

ARRAY TEXT(obj_names;2)
obj_names{1}:="Button"
obj_names{2}:="Combo Box"

set_objects_visibility (->obj_names;False)