The DataInput module gives access to user defined DataInput pages.
The DataInput class
- GetDataInput(<name>) - get the named data input object
Attributes of the DataInput class
Attribute |
Access |
Type |
Description |
name |
R |
string |
the name |
handle |
R |
HANDLE |
the windows handle of scrollbox, same as
scrollbox.handle |
userPanel |
R |
scrollbox |
returns the scrollbox where all user configured controls are placed |
bttnPanel |
R |
panel |
returns button panel |
captionPanel |
R |
panel |
returns the topmost caption panel |
page |
R |
string |
name of DataInput page |
groups |
R |
Tuple |
return a tuple of configured groups and
parameter names |
Methods of the DataInput class
Method |
Returns |
Description |
apply() |
bool |
same as pressing the Apply button |
undo() |
bool |
same as pressing the Undo button |
refresh() |
bool |
refresh the data input view |
changed() |
bool |
updates/recreates parameters/controls after
modifications and saves the configurations. |
getParameter(group,param) |
obj |
returns DataInputParameter given by group and
name |
getParameterByChild(ctrl) |
obj |
returns ctrl's DataInputParameter |
The DataInputParameter class
Attributes of the DataInputParameter class.
Attribute |
Access |
Type |
Description |
name |
R |
string |
the user defined name |
caption |
R/W |
string |
the user defined caption |
group |
R |
string |
the parameter group name |
dataInput |
R |
obj |
the parameter DataInput instance |
parameterType |
R |
int |
0=scalar/text,1=option,2=list,3=decoration,4=memo,5=line,6=spacer,7=custom,8=enum |
parameter |
R/W |
string |
applies to parameterType 0,1 and 3 only |
optParameter |
R/W |
string |
applies to parameterType 0 only |
browserClass |
R |
string |
kind of browser attached to browse button |
value |
R/W |
float |
current value |
valueAsText |
R/W |
string |
textual representation of value |
measurementUnit |
R |
string |
not used |
indent |
R/W |
int |
no of indentations |
spinInc |
R/W |
string |
the spin control increment if configured,
numeric or link as string |
spinMin |
R/W |
string |
the spin control min value if configured,
numeric or link as string |
spinMax |
R/W |
string |
the spin control max value if configured,
numeric or link as string |
height |
R/W |
int |
height of visual control. Applies to |
flags |
R |
int |
bit0=ReadOnly,bit1=Immediate,bit2=browser,bit3=RightJustify,bit4=Optional,
bit5=spinControl |
config |
R/W |
string |
the parameter configuration |
control |
R |
control |
the attached GUI control |
Methods of the DataInput class
Method |
Returns |
Description |
getControl(name) |
control |
returns a contained control in custom controls.
To browse the contained controls, use the control.controls, as
"print param.control.controls" |
The control property normally holds a single control, as a Edit for
scale/text parameters, or a SwitchBox for an option parameter, but
for custom controls the control mey be a container for multiple
controls, as a StatePanel or a IndicatorPanel.Example 1: Refresh DataInput panel
# update values used by a data input view
SetValue('Config.Threshold',12) #set new threshold in ExternalData tool
SetValue('Config.MaxLevel',3) #set new level in ExternalData tool
GetDataInput('Configuration').refresh()) #refresh the datainput view to reflect changes
Example 2: Accessing an Indicator Panel
Step 1 - in PageAdmin - insert a DataInput named "Status"
Step 1 - in the DataInput "Status", insert a group "G1" by "New group"
Step 2 - in the group "G1", insert a "IP" by "New Parameter"
Step 3 - run the below Central script
def SetupIndicatorPanel():
di=GetDataInput('Status") #returns the DataInput object
param=di.getParam('G1','IP') #returns the parameter object holding the indicator panel
ipm=param.getControl('IndicatorPanel') #returns the contained indicator panel object
ipm.getIndicatorPanel(0,2).state=2 #fail
More...
|