Object Functions

These functions allow you to modify properties such as Color, Position, size and visibility, of objects visible on an given window. Generally for most functions you have to specify the window name and the object name that you want to modify. These functions are usable in the following script types (basically all of the script types)

  • Application Scripts
  • Class Scripts
  • Window Scripts
  • User Functions
  • Script Variables

The object functions allow you to build very complex logic in classes that would otherwise not be possible. For example it is possible to build complex visibility conditions that are dependent on multiple variables or even database queries or the filesystem.

Window Name

The Window name can generally retrieved via “string GetWinName()” to get the name of the window that the Script is currently running on. Of course you can also pass in the Window name from any string variable you need, which allows you to construct these names dynamically.

Object Name

The Object name is the name that the object was given in the graphics settings of the corresponding object. These names are generally composed of the object type and an running number separated by an underline. For example (“Text_1234”). In the Script editor you can also right click and open the “Element” selection menu to select an element of the current window. Of course this selection is only possible in Window scripts. In all other functions types, you have to specify the Object name manually.

Object name in Classes

The object functions are also usable in Classes and allow you to build very complex logic in classes that would otherwise not be possible. In order to use these functions you have to know how the Classes are instantiated during runtime. During runtime each used object gets instantiated by using the Class Object’s name, this is the Name that is given to the class in the editor (not to be confused with the “VariableBaseName), and then the elements name of the object get appended with an underline “_”. If an Class is Instantiated during runtime, it is called an Class Object, or Object.

There is an function you can use to get the current Class Objects name during runtime (string GetObjName()). this function is only usable in Class Scripts, because it does not make sense without classes. In order to modify the element of an Class in an Class script you have to build the final elements name by using this formula:

<Objects Name>_<Elements name inside the Class>

usually you do that by using the following code:

SetPropLineColor(GetWinName,GetObjName + ‘_Rechteck_1’, clBlue)

Note that the elements name is composed of the objects name, followed by an underline and the elements name that is given in the Class editor.

Colors

The following Constants can be used for all functions that receive color values. Of course you can also construct the RBG value yourself by using any graphics software you like. The values are basically integers of the following format:

0x00BBGGRR where:

  • RR is the red value 0-255
  • GG is the green value 0-255
  • BB is the blue value 0-255

the alpha channel is not supported.

for example:

light Red = Red 255, Green 128, Blue 128 = 0x008080FF

gold brown = Red 162, Green 143 Blue 13 = 0x000D8FA2

ConstantColor Value
clBlack0x000000
clMaroon0x000080
clGreen0x008000
clOlive0x008080
clNavy0x800000
clPurple0x800080
clTeal0x808000
clRed0x0000FF
clLime0x00FF00
clYellow0x00FFFF
clBlue0xFF0000
clFuchsia0xFF00FF
clAqua0xFFFF00
clLtGray0xC0C0C0
clDkGray0x808080
clWhite0xFFFFFF
Color constants

ExistObj

Declaration bool ExistObj(string f, string e)
Function Determines whether the specified element e exists in window f.
Example bool f
f := ExistObj(‘Fenster_1’, ‘Taster_1’)

GetClassName

Declaration string GetClassName
Function Returns the class name of an object script. Only usable in Class Scripts. Not to be confused with GetObjName, which gets the objects name that you need for use in Class Scripts. This function is mostly for debugging.
Cross GetObjName, GetVarBaseName
Example string clsName
clsName := GetClassName

GetObjName

Declaration string GetObjName
Function Provides the object name of item group or Object scripts.
Works only in scripts associated with an Class object. Use this function to the the Class objects name to use in Class Scripts
Cross GetVarBaseName, GetWinName
Example string text1, text2, objname, elename, winname

objname := GetObjName
winname := GetWinName

text1 := GetText(objName, 1, ‘Text’)
text2 := GetText(objName, 2, ‘Text’)

elename := objname + ‘_’ + ‘Text_1’
SetPropText(winName, elename, text1)
elename := objname + ‘_’ + ‘Text_2’
SetPropText(winName, elename, text2)

GetObjNameList

Declaration tring GetObjNameList(string szWin, szObj)
Function Returns the object names of the sub-ordinated elements of the szObj element in the szWin window. If the element specifies blank string, the window’s object names are supplied. The delimiter is the semi colong “;”.
Cross GetObjParent
Example string szObjs
szObjs := GetObjNameList(‘Fenster_1’, ‘Text_1’)

GetObjParent

Declaration string GetObjParent(string szWin, szObj)
Function Returns the object name of the parent of the szObj element in the szWin window. If the element does not have a parent, Blank String will return. 
Cross eList
Example string szObjParent

szObjParent := GetObjParent(‘Fenster_1’, ‘Text_1’)

GetObjType

Declaration string GetObjType(string szWin, szObj)
Function Returns the element type of the szObj element in the szWin window.
Example string szObjType

szObjType := GetObjType(‘Fenster_1’, ‘Text_1’)

GetPropBrushColor

Declaration long GetPropBrushColor(string f, string e)
Function returns the fill color of the specified element e in the window f.
Cross SetPropBrushColor
Example long clr
clr := GetPropBrushColor(‘Fenster_1’, ‘Rechteck_1’)

GetPropEnabled

Declaration bool GetPropEnabled(string f, string e)
Function Determines whether the specified element is e enabled or disabled in windows. This function can be used for elements of the type button, or sliders.
Cross SetPropEnabled
Example bool fEnabled
fEnabled := GetPropEnabled(‘Fenster_1’, ‘Taster_1’)

GetPropLineColor

Declaration long GetPropLineColor(string f, string e)
Function Determines the line color of the specified element e in the window f.
Cross SetPropLineColor
Example long clr
clr := GetPropLineColor(‘Fenster_1’, ‘Rechteck_1’)

GetPropPosbottom

Declaration

long GetPropPosBottom(string f, string e)

Function

Determines the lower position of the specified element e in the f window

Cross SetPropposbottom
Examplelong Pos

Pos := GetPropPosbottom(‘Fenster_1’, ‘Rechteck_1’)

GetPropPosLeft

Declaration

long GetPropPosLeft(string f, string e)

Function

Determines the left position of the specified element e in the f window.

Cross

SetPropPosLeft

Example

long Pos

Pos := GetPropPosLeft(‘Fenster_1’, ‘Rechteck_1’)

GetPropPosRight

Declaration

long GetPropPosRight(string f, string e)

Function

Determines the right position of the specified element e in the f window.

Cross

SetPropPosRight

Example

long Pos

Pos := GetPropPosRight(‘Fenster_1’, ‘Rechteck_1’)

GetPropPosTop

Declaration

long GetPropPosTop(string f, string e)

Function

Determines the top position of the specified element e in the window f.

Cross

SetPropPosTop

Example

long Pos

Pos := GetPropPosTop(‘Fenster_1’, ‘Rechteck_1’)

GetPropText

Declaration string GetPropText(string f, string e)
Function Gets the text of the specified element e in window f. This function can be used for elements of type Text, or one-output field.
Cross SetPropText
Example string text, objname, elename, winname
objname := GetObjName
winname := GetWinName
elename := objname + ‘_’ + ‘Text_1’
text := GetPropText(winName, elename)

GetPropTextColor

Declaration long GetTextLineColor(string f, string e)
Function Determines the text color of the specified element e in the window f.
Cross SetPropTextColor
Example long clr
clr := GetPropTextColor(‘Fenster_1’, ‘Text_1’)

GetPropToolTip

Declaration string GetPropToolTip(string win, string element)
Function Returns the tooltip text of the element specified by win and element, provided that the item’s Show Tooltip property is set.
Cross SetPropToolTip, GetPropToolTipEnabled, SetPropToolTipEnabled
Example string s
s := GetPropToolTip(‘Fenster_1’, ‘Text_1’)

GetPropToolTipEnabled

Declaration bool GetPropToolTipEnabled(string win, string element)
Function Returns the value of the Show Tooltip property of the element specified by win and element.
Cross GetPropToolTip, SetPropToolTip, SetPropToolTipEnabled
Example bool b
b := GetPropToolTipEnabled(‘Fenster_1’, ‘Text_1’)

GetPropVisible

Declaration bool GetPropVisible(string f, string e)
Function Determines whether the specified element e is visible or invisible in the f window. This function can be performed on all items
Cross SetPropVisible
Example bool fVisible
fVisible := GetPropVisible(‘Fenster_1’, ‘Rechteck_1’)

GetSelectedItem

Declaration long GetSelectedItem(string f, string e)
Function Finds the selected entry of the ListBox of the specified element e in the window f. This function can only be performed on ListBox items.
Cross SetSelectedItem SetSelectedItem
Example long nItem
nItem := GetSelectedItem(‘Fenster_1’, ‘Listbox_1’)

GetVarBaseName

Declaration string GetVarBaseName
Function Returns the variable base name of an object script.
Cross GetObjName
Example string varBaseName
varBaseName := GetVarBaseName

IsPropBitmapValid

Declaration

bool IsPropBitmapColorValid(string szWin, string szObj)

Function

Whether the property bitmap of the specified element szObj can be set in the szWin window.

Cross

SetPropBrushBitmap

Example

bool fValid
fValid := IsPropBitmapValid(‘Fenster_1’, ‘Bitmap_1’)

IsPropBrushColorValid

Declarationbool IsPropBrushColorValid(string szWin, string szObj)
FunctionWhether the property fill color of the specified element szObj can be set in the szWin window.

Cross

GetPropBrushColor, SetPropBrushColor

Examplebool fValid
fValid := IsPropBrushColorValid(‘Fenster_1’, ‘Rect_1’)

IsPropEnabledValid

Declaration bool IsPropEnabledValid(string szWin, string szObj)
Function Whether the Property Enabled of the specified element szObj can be set in the szWin window.
Cross GetPropEnabled, SetPropEnabled
Examplebool fValid
fValid := IsPropEnabledValid(‘Fenster_1′, Button_1’)

IsPropLineColorValid

Declaration bool IsPropLineColorValid(string szWin, string szObj)
Function Whether the property line color of the specified element szObj can be set in the szWin window.
Cross GetPropLineColor, SetPropLineColor
Example bool fValid

fValid := IsPropLineColorValid(‘Fenster_1’, ‘Line_1’)

IspropPosvalid

Declaration bool IsPropPosValid(string szWin, string szObj)
Function Whether the property position of the specified element szObj can be set in the szWin window.
Cross SetProppos
Example bool fValid
fValid := IsPropBrushColorValid(‘Fenster_1’, ‘Rect_1’)

IspropTextValid

Declaration bool IsPropTextValid(string szWin, string szObj)
Function set in the szWin window.
Cross GetPropText, SetPropText
Example bool fValid
fValid := IsPropTextValid(‘Fenster_1’, ‘Text_1’)

IsPropTextColorValid

Declaration bool IsTextLineColorValid(string szWin, string szObj)
Function Whether the property line color of the specified element szObj can be set in the szWin window.
Cross GetPropTextColor, SetPropTextColor
Example bool fValid
fValid := IsPropTextColorValid(‘Fenster_1’, ‘Text_1’)

IsPropToolTipValid

Declaration bool IsPropToolTipValid(string szWin, string szObj)
Function Whether the Property ToolTip of the specified element szObj can be set in the szWin window.
Cross GetPropToolTip, SetPropToolTip
Example bool fValid
fValid := IsPropToolTipValid(‘Fenster_1’, ‘Button_1’)

IsPropToolTipEnabledValid

Declaration bool IsPropToolTipEnabledValid(string szWin, string szObj)
Function Whether the Property ToolTip Enabled of the specified szObj element can be set in the szWin window.
Cross GetPropToolTipEnabled, SetPropTooltipEnabled
Example bool fValid
fValid := IsPropToolTipEnabledValid(‘Fenster_1’, ‘Button_1’)

IsPropVisibleValid

Declaration bool IsPropVisibleValid(string szWin, string szObj)
Function Whether the property visibility of the specified element szObj can be set in the szWin window.
Cross GetPropVisbible, SetPropVisible
Example bool fValid
fValid := IsPropVisibleValid(‘Fenster_1’, ‘Text_1’)

SetVarBaseName

Declaration SetVarBaseName (string f, string o, string v)
Function Sets the variable base name of the object o in the window f to the value specified in v.
Example SetVarBaseName(‘Fenster_1’, ‘Ventil_1’, ‘Inlet’)

SetPropBitmap

Declaration SetPropBitmap(string f, string e, string filename)
Function Sets the graphic file of the specified element e. in the f window. This feature is only available for bitmap elements. The filename must be the fully qualified name of the file. To point to the default Datapath, you can use:
GetPrjDir + ‘USER_DAT\\Bitmap\\ButtonGreen.bmp’
Example SetPropBitmap(‘Fenster_1’, ‘Bitmap_1’, ‘C:\\Silo.bmp’)

SetPropBrushColor

Declaration SetPropBrushColor(string f, string e, long clr)
Function Sets the fill color of the specified element e in the window f with the specified color clr.
Cross GetPropLineColor, Colors
ExampleSetPropBrushColor(‘Fenster_1’, ‘Rechteck_1’, clred)
SetPropBrushColor(‘Fenster_1’, ‘Rechteck_2’, clgreen)
SetPropBrushColor(‘Fenster_1’, ‘Rechteck_3’, clblue)

SetPropEnabled

Declaration SetPropEnabled(string f, string e, bool fEnabled)
Function Sets the state of the e element in window f to enabled if fEnabled is true, or disabled if fEnabled is false. This function can be used for elements of type buttons, EA fields or sliders.
Cross GetPropEnabled
Example SetPropEnabled(‘Fenster_1’, ‘Taster_1’, false)

SetPropLineColor

Declaration SetPropLineColor(string f, string e, long clr)
Function Sets the line color of the specified element e in the window f with the specified color clr.
Cross GetPropBrushColor, GetPropLineColor, Colors
Example SetPropLineColor(‘Fenster_1’, ‘Rechteck_1’, clred)
SetPropLineColor(‘Fenster_1’, ‘Rechteck_2’, clgreen)
SetPropLineColor(‘Fenster_1’, ‘Rechteck_3’, clblue)

SetProppos

Declaration SetPropPos(string f, string e, long x1, long y1, long x2, long y2)
Function Sets the element e in the f window. This feature is currently only available for line elements!
Example SetPropPos(‘Fenster_1’, ‘Linie_1’, 100, 100, 200, 200)

SetPropText

Declaration SetPropText(string f, string e, string text)
Function Sets the text of the specified element e in window f. This function can be used for elements of type Text, or in/out field.
Cross GetPropText
Example See example GetObjName

SetPropTextColor

Declaration: SetPropTextColor(string f, string e, long clr)
Function: Sets the text color of the specified element e in the window f with the specified color clr.
Cross: GetPropTextColor
Example: SetPropTextColor(‘Fenster_1’, ‘Text_1’, clRed)

SetPropToolTip

Declaration SetPropToolTip(string win, string element, string text)
Function Sets the tooltip text of the element specified by win and element to text, provi
Cross GetPropToolTip, GetPropToolTipEnabled, SetPropToolTipEnabled
Example SetPropToolTip(‘Fenster_1’, ‘Text_1’, ‘Tooltip Text_1’)

SetPropToolTipEnabled

Declaration EnablePropToolTip(string win, string element, bool how)
Function Sets the ‘Show Tooltip’ property of the element specified by win and element to how (true / false)
Cross GetPropToolTip, SetPropToolTip, GetPropToolTipEnabled
Example SetPropToolTipEnabled(‘Fenster_1’, ‘Text_1’, true)

SetSelectedItem

Declaration long SetSelectedItem(string f, string e, long n)
Function Selects the entry n of the ListBox of the specified element e in the window f. This function can only be performed on ListBox items.
Cross GetSelectedItem
Example long nItem

nItem := 5
SetSelectedItem(‘Fenster_1’, ‘Listbox_1’, nItem)

SetPropVisible

Declaration SetPropVisible(string f, string e, bool fVisible)
Function Sets the state of the specified element e in the window f to visible if fVisible is true, or invisible if fVisible is false. This function can be performed on all items.
Cross GetPropVisible
Example SetPropVisible(‘Fenster_1’, ‘Rechteck_1’, false)