hasMethod()

The function returns TRUE when the specified method exists.

Synopsis

bool hasMethod(string|shape object[,string methodName);

Parameter

Parameter Description
object The Control++ object.
methodName Name of the method that is queried.

Return value

The function returns TRUE when the method with the specified name exists in the ScopeLib and is public. The function returns FALSE in all other cases.

Example

The Methods "outText" as well as the events "valueChanged" and "buttonClicked" exist in the ScopeLib of a reference.

#event valueChanged(int value) #event buttonClicked() public string outText()
                { DebugN("DP value queried"); }
In the reference that is used in a panel, in the event buttonClicked()the code
 bool b =
                hasMethod("PANEL_REF4","outText")
is used. Since the reference "PANEL_REF4" contains the method "outText", the function "hasMethod" returns TRUE.
  1. void buttonClicked()
    
    
    {
    
    
       float val;
    
    
       dpGet("System1:ExampleDP_Arg1.",val);
    
    
       DebugN("dpGet: ", val);
    
    
       anytype val2;
    
    
       val2 = val;
    
    
       TEXT_FIELD1.text(val2);
    
    
       bool ev;
    
    
       anytype a = invokeMethod("PANEL_REF4","outText");
    
    
       DebugN("Method outText Invoked");
    
    
       bool b = hasMethod("PANEL_REF4","outText");
    
    
       DebugN("Has method:", b);
    
    
    }

Assignment

Object Oriented Scripting (CTRL++)

Availability

UI