Snippets

SeanB Object Display Toggle

Created by SeanB

File cObjectDisplayToggle.pkg Added

  • Ignore whitespace
  • Hide word diff
+Use cDictionary.pkg
+
+//Objects registered can then be easily turned on and off based on a string value. 
+
+Class cObjectDisplayToggle is a cDictionary
+    Procedure RegisterObject Integer iObj String sType 
+        Send AddKey iObj sType 
+    End_Procedure
+    
+    Function isShowObject String sType String sObjectType Returns Boolean 
+        Function_Return ((Uppercase(sType)) = (Uppercase(sObjectType))) 
+    End_Function
+    
+    Procedure DisplayObjects String sType
+        String sObjectType
+        Variant[] vKeys 
+        Integer iPos 
+        Integer iMax 
+        Integer hObj 
+        Boolean isDisplay
+        
+        Get DictionaryKeys to vKeys 
+        Move (SizeOfArray(vKeys)) to iMax 
+        For iPos from 0 to (imax-1)
+            Move (Integer(vKeys[iPos])) to hObj 
+            Get KeyValue vKeys[iPos] to sObjectType 
+            
+            Move (isShowObject(Self,sType,sObjectType)) to isDisplay
+            Set Enabled_State of hObj to isDisplay 
+            Set Visible_State of hObj to isDisplay 
+        Loop
+    End_Procedure
+End_Class
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.