Skip to main content

NotebookAction

NotebookAction [/W=winName ] keyword = value [, keyword = value ...]

The NotebookAction operation creates or modifies an "action" in a notebook. A notebook action is an object that executes commands when clicked.

See Notebooks for general information about notebooks.

NotebookAction returns an error if the notebook is open for read-only. See Notebook Read/Write Properties for further information.

Parameters

The parameters are in keyword =value format. Parameters are automatically limited to legal values before being applied to the notebook.

bgRGB=(r, g, b)Specifies the action background color. r , g and b specify the amount of red, green, and blue as integers from 0 to 65535.
commands=strSpecifies the command string to be executed when clicking the action. For multiline commands, add a carriage return (\r) between lines.
enableBGRGB=enableUses the background color specified by the bgRGB parameter (enable=1). Background color is ignored for enable=0.
frame=fSpecifies the frame enclosing the action.
f =0:No frame.
f =1:Single frame.
f =2:Double frame.
f =3:Triple border.
f =4:Shadow frame.
helpText=helpTextStrSpecifies the help string for the action. The text is limited to 255 bytes. Help appears in the status line when the cursor is over the action.
ignoreErrors=ignoreControls whether an error dialog will appear (ignore=0) or not (ignore is nonzero) if an error occurs while executing the action commands.
linkStyle=linkStyleControls the text style of the action title. If linkStyle=1, the style is the same as a help link (blue underlined). If linkStyle=0, the style properties are the same as the preceding text.
name=nameSpecifies the name of the new or modified notebook action. This is a standard Igor name. See Standard Object Names for details.
padding={leftPadding, rightPadding, topPadding, bottomPadding, internalPadding }
Sets the padding in points. internalPadding sets the padding between the title and the picture when both elements are present.
picture=nameSpecifies a picture for the action icon. name is the name of a picture in the picture gallery (see Pictures).
If name is null ($""), it clears the picture parameter.
procPICTName=nameSpecifies a Proc Picture for the action icon (see Proc Pictures). name is the name of a Proc Picture or null ($"") to clear it. This will be a name like ProcGlobal#myPictName or MyModuleName#myPictName. If you use a module name, the Proc Picture must be declared static.
If you specify both picture and procPICTName, picture will be used.
quiet=quietDisplays action commands in the history area (quiet =0), otherwise (quiet =1) no commands will be recorded.
scaling={h, v}Scales the picture in percent horizontally, h, and vertically, v.
showMode=modeDetermines if the title or picture are displayed.
mode =1:Title only.
mode =2:Picture only.
mode =3:Picture below title.
mode =4:Picture above title.
mode =5:Picture to left of title.
mode =6:Picture to right of title.
Without a picture specification, the action will use title mode regardless of what you specify.
title=titleStrSets the action title to titleStr, which is limited to 255 bytes.

Flags

/W= winNameSpecifies the notebook window of interest.
winName is either kwTopWin for the top notebook window, the name of a notebook window or a host-child specification (an hcSpec) such as Panel0#nb0. See Subwindow Syntax for details on host-child specifications.
If /W is omitted, NotebookAction acts on the top notebook window.

Examples

String nb = WinName(0, 16, 1)	// Top visible notebook
NotebookAction name=Action0, title="Beep", commands="Beep" // Create action
NotebookAction name=Action0, enableBGRGB=1, padding={4,4,4,4,4}
Notebook $nb, findSpecialCharacter={"Action0",1} // Select action
Notebook $nb, frame=1 // Set frame

See Also

Notebooks

Notebook, NewNotebook, OpenNotebook

SpecialCharacterList, SpecialCharacterInfo

Demos

Open Notebook Actions Demo