Skip to main content
Version: Next

Get action info

Get action info ( action {; target} ) -> Function result

ParameterTypeDescription
actionString🡒Standard action name or pattern including parameter if required
targetLongint🡒Defines the target of the action to get information: main form or current form
Function resultObject🡐Object containing action status as boolean properties: isEnabled, isVisible, isChecked, isMixed, isUnknownState

Description

The Get action info command returns several information, including availability and status, about the defined action in the target, according to the current application context.

In action, pass the standard action to to check. It can be a string or a constant from the Standard Action theme. It can be a string or a constant from the Standard Action theme. Some actions accept a target element and parameters. In this case, you must use the requested pattern, for example "gotoPage?value=2" or paragraph/backgroundPositionV?value=top.

Available 4D actions are listed in the Standard actions section of the 4D Design Reference manual.

Note: Additional specific actions are also provided for 4D Write Pro documents. They are detailed in the Using 4D Write Pro standard actions section of the 4D Write Pro Reference manual.

You can pass in target the form context where the action must be executed, if available. You can use one of the following constants from the Standard Action theme:

ConstantTypeValueComment
ak current formLongint1The current form is the form where the action was called. It could be either the main form or a palette form in front of the main form of the current process.
ak main formLongint2The main form is the frontmost document or dialog form of the process, excluding any floating or pop-up window.

Note: If target is omitted, by default the ak current form context is used.

The Get action info command returns information in the form of an object containing the following properties:

PropertyTypeDescription
enabledBooleantrue if the action can be invoked, false otherwise
statusStringValue can be one of the following strings:
"checked"the action is checked, which means that the property is set. Ex: the selected text is bold, the standard action ak font bold "status" property contains "checked"
"unchecked"the action is unchecked, which means that the property is not set. Ex: the selected text is not bold, the standard action ak font bold "status" property contains "unchecked".
"mixed"the action is mixed, which means that the property is partially set. Ex: part of the selected text is "bold", the standard action ak font bold "status" property contains "mixed".
titleTextCurrent localized name of the action label. Ex: "Undo", "Paste", etc. for the english version.
visibleBooleantrue if the action is visible in the form
valueStringCurrent value of the action parameter string (if any). For example, if the standard action is "fontSize?value=10pt", the value property contains "10pt"

If the action status cannot be determined (for example if it is not affected to any object or menu command), the command returns a null object (undefined).

Example

You want to know if the copy action is available (i.e. if some data is selected):

 var $actionInfo : Object
 var $isEnabled : Boolean
 $actionInfo:=Get action info(ak copy)
 If(Not(Undefined($actionInfo.enabled))) //action is defined in the process
    If(OB Get($actionInfo;"enabled"))
       ... //the copy action is available
    End if
 End if

See also

INVOKE ACTION
SET LIST ITEM PARAMETER