ZenMenuItem

 

Remarks Properties Methods DynProperties Samples

ED
avaliable
RT
read only

Remarks:Top

With an object of this type items of a context menu and main menu submenus can be edited, deleted, created,...

Properties:Top

ActionID Caption Checked
Count Enabled Guid
HelpFile HelpTopic ID
MenuID Name Parent
ParentID Password Picture
Popup Seperator SetValue
ShowSetValueDlg Tooltip Type
UseCurValue VarFromElement Visible

Methods:Top

Create Delete DynPropertiesEnum[GET]
DynProperties[GET] DynProperties[PUT] Item

DynProperties:Top

Name Type Description
ActValue Boolean

Propose current value

Only available for action type "Set Value":
Active: The current value of the variable is proposed as set value.
Inactive: The set value is defined in the properties of the menu entry.
Default: inactive.

Read more in the online manual

BackgroundPicRepres Long

Alignment

Size of the background picture for the menu entry.
Original size: The picture is displayed in ist original size. The menu entry is stretched to the picture size.
Stretched: The picture is stretched to the size of the menu entry.
Default: original size.

Example: Menus sshould be used in a touchscreen project. As a standard for the size of the single menu entries the settings of the operating system are taken. With a background picture in original size however the size of the single menu entries can be defined individually.

Read more in the online manual

BackgroundPicture ZT_FILE

Graphics file

Background picture for the menu entry.

Read more in the online manual

Caption String

Text

Text of the menu entry in the menu.

Read more in the online manual

Checked Boolean

Check mark

Active: In front of the menu entry a check mark is displayed
Inactive: No check mark is displayed.
(only graphical display).
Default: inactive.

Read more in the online manual

Enabled Boolean

Active

Active: The menu entry is displayed normal and the linked action is executed on selecting the entry.
Inactive: The entry is displayed greyed and the linked action is not executed.

Read more in the online manual

FromElem Boolean

Variable from element

Only available for action type "Set Value" and context menus:
Active: Variable for setting the value is taken from the dynamic element.
Inactive: Variable for setting the value is defined in the properties of the menu entry.
Default: inactive.

Read more in the online manual

Function ZT_FUNCTION

Function

Only available for action type "Function":
Function, which should be executed with the selected menu entry.
If more than one function should be executed here, a script with all the desired functions has to be created and the function for executing the script is linked here.

Read more in the online manual

HelpCapture String

Chapter

Only available for action type "Help":
Help chapter that should be displayed.

ATTENTION: This entry is case sensitive.
In context menus this entry can stay empty. Then the defined help pages of the linked elements are displayed.
Usually the defined help pages of the linked elements are displayed. If a linked element has no help page, this page is displayed instead.

Read more in the online manual

HelpFile ZT_FILE

File

Only available for action type "Help":
Help file, from which a chapter should be displayed.
Usually the defined help pages of the linked elements are displayed. If a linked element has no help page, this page is displayed instead.

Read more in the online manual

Locking Long

Interlocking

Selection of an interlocking for the menu entry.

Read more in the online manual

Name String

Name

Name of the menu entry.

Read more in the online manual

Password Long

Authorization group

Password level for executing this menu entry.

Read more in the online manual

Picture ZT_FILE

Bitmap

Bitmap that should be displayed with the menu entry.

Read more in the online manual

Popup-Menu Boolean

Submenu

Active: The menu entry does not execute an action, but opens a submenu.
Inactive: The menu entry executes the defined action.

Read more in the online manual

SWDialog Boolean

Dialog

Only available for action type "Set Value":
Active: On executing this action a dialogbox is opened before sending the value to the hardware allowing the user to change the value before sending it.
Inactive: The value defined in the properties of the menu entry is directly sent to the hardware.
Default: inactive.

Read more in the online manual

Seperator Boolean

seperator

Active: The menu entry does not execute an action, but displays a seperator (horizontal line).
Inactive: The menu entry executes the defined action.

Read more in the online manual

Signature Boolean

Active: Operating the element needs a signature.
Even if a user is logged in, he/she has to enter his/her password again for security reasons. After successful operation the signature text is logged in the Chronologic Event List (CEL).

Attention: Only users that are logged in can sign an action. Signing actions with a temporary login is no longer possible.

Inactive: No signature is needed.
Default: inactive.

SignatureText String

Signature text

This text is logged in the Chronologic Event List (CEL) on signing or is proposed as a default in the Runtime, if the signature is defined to be editable in the project properties.

Read more in the online manual

Sollwert Double

Set value/Change by

Only available for action type "Set Value":
Value that should be sent to the defined variable.
If the property "Propose current value" is activated, the current value of the variable is increased (positive value) or decreased (negative value) by this value.

Read more in the online manual

Type Long

Action type

Seven action types are available:
Function: A function is executed.
Help: A help entry is displayed.
No action: No action is executed.
Set value: A value is sent to the hardware.
VBA macro: A VBA macro is executed.
Acknowledge alarms: Acknowledges the alarms of all variables linked to the dynamic element that the context menu refers to.
Acknowledge flashing: Switches off the flashing statusof the alarms of all variables linked to the dynamicelement that the context menu refers to. The alarm itselfis not acknowledged.

Read more in the online manual

VBA-Macro ZT_VBAMAKRO

VBA macro

Only available for action type "VBA macro":
VBA macro that should be executed with the selected emnu entry.

Read more in the online manual

Variable ZT_VARIABLE

Variable

Only available for action type "Set Value":
Variable to which a value should be sent with the selected menu entry.

Read more in the online manual

Visible Boolean

visible

Active: The menu entry is displayed in the Runtime.
Inactive: The menu entry is not displayed in the Runtime.

Read more in the online manual

Samples:Top



'This sample creates a context and a main menu with one item each.
'The main menu item can execute a set value function.
'The context menu item can execute a vba makro.
'Preparation: A variable and a makro have to be available
Sub ZenMenuItem()

Dim zMenus As ZenMenus  'Parent object
Dim zMenu As ZenMenu	'Child object of ZenMenus
Dim zMenuItem As ZenMenuItem 'Child object of ZenMenu

Set zMenus = MyWorkspace.ActiveDocument.ZenMenus

'Create a main menu
Set zMenu = zMenus.Create("Main_1")
zMenu.IsPulldown = True
'Create a main menu item
Set zMenuItem = zMenu.Create("ID_1", True)
'Set text of menu item
zMenuItem.Caption = "First"

'Create a context menu
Set zMenu = zMenus.Create("Context_1")
zMenu.IsPulldown = False
'Create a context menu item
Set zMenuItem = zMenu.Create("id_1", True)
'Set text of menu item
zMenuItem.Caption = "first"

'Projects the set value action at the main menu item
Call setValue(zMenus)
'Projects the makro action at the context menu item
Call setMakro(zMenus)

End Sub

Sub setValue(Menus As ZenMenus)

Dim zVar As Variable	'Variable for the set value function
Dim Menu As ZenMenu	 'Child object of ZenMenus
Dim MenuItem As ZenMenuItem 'Child object of ZenMenu

'Select the main menu
Set Menu = Menus.Item(0)
'Select the first main menu item
Set MenuItem = Menu.Item(0)

'Object of variable "test" is assigned
Set zVar = MyWorkspace.ActiveDocument.Variables.Item("test")
'Deactivate the submenus
MenuItem.Popup = False
'Select set value as the action type of the menu item
MenuItem.Type = tpVariable
'The variable of the set value function is assigned via Ids
MenuItem.ActionID = zVar.PvID
'Set the "change by" value to 5
MenuItem.setValue = 5

End Sub

Sub setMakro(Menus As ZenMenus)

Dim zVar As Variable	'Variable for the set value function
Dim Menu As ZenMenu
Dim MenuItem As ZenMenuItem

'Select the context menu
Set Menu = Menus.Item(1)
'Select the first context menu item
Set MenuItem = Menu.Item(0)
'Deactivate the submenus
MenuItem.Popup = False
'Select set value as the action type of the menu item
MenuItem.Type = tpVbaMacro
'Set the Macro via the dynProperties
MenuItem.DynProperties("VBA-Macro") = "Init_Default"

End Sub