Share this page 

Enable/disable a component from its nameTag(s): Powerscript


Scan the Window Control array to extract a reference to the desired component. In this example, we are looking for a Command Button called "cb_1".
Commandbutton lcb
int i
int j

j = upperbound(parent.Control)
FOR i = 1 TO j 
 IF parent.Control[i].TypeOf() = commandbutton! THEN 
     IF parent.Control[i].ClassName() = "cb_1" THEN
         // we got it!
         lcb = parent.Control[i]
        EXIT
     END IF
 END IF
NEXT

IF NOT IsNull(lcb) THEN
   lcb.enabled = false
   lcb.text = "DISABLED"
END IF