Cicode Programming Reference > Cicode Function Categories > Menu Functions Introduction > MenuNodeSetDisabledWhen

MenuNodeSetDisabledWhen

Set the DisabledWhen expression for a newly added node. Be aware this function only works for menu nodes added with MenuNodeAddChild(). The DisabledWhen expression may only be set once for a node.

Be reminded that changes made to the menu tree will not be persisted back to the menu configuration database.

Syntax

MenuNodeSetDisabledWhen(hNode, sDisabledWhenName [, sDisabledWhenArgs] [, iDisabledStyle])

hNode:

Handle of node to run command

sDisabledWhenName:

Cicode function for DisabledWhen expression. The function needs to return an INT.

sDisabledWhenArgs:

Cicode parameters for DisabledWhen expression. Only supports static arguments.

iDisabledStyle:

Disabled Style. Allows different display styles for a disabled menu item.

Return Value

CT_ERROR_NO_ERROR (0) on success, CT_ERROR_BAD_HANDLE (269) if hNode does not refer to a valid node, CT_ERROR_INVALID_ARG (274) if DisabledWhen Cicode has already been set or is not a valid expression.

Related Functions

MenuGetChild, MenuGetFirstChild, MenuGetGenericNode, MenuGetNextChild, MenuGetPageNode, MenuGetParent, MenuGetPrevChild, MenuGetWindowNode, MenuNodeAddChild, MenuNodeGetProperty, MenuNodeHasCommand, MenuNodeIsDisabled, MenuNodeIsHidden, MenuNodeRemove, MenuNodeRunCommand, MenuNodeSetHiddenWhen, MenuNodeSetProperty, MenuReload

Example

INT hNode = MenuNodeAddChild((hParent, "LogIn", "LogIn");
INT Error = MenuNodeSetDisabledWhen(hNode, "UserInfo", "0", 1);

See Also

Menu Functions Introduction

Menu Functions