Username: Password:

Menu Plug-in Scripting Reference



Overview

The menu plugin implements pop-up menus, pull down menus, hierarchical menus, menu bars, menu buttons, and combo boxes in a variety of styles.

The default script for menus allows multiple menus to be connected together into menubars, pulldowns, and submenus.

Menus can also be used by themselves, as in the case of tear-off menus. Menu buttons and combo boxes can also have submenus.

Messages: nodemove, nodechange, nodeselect, nodeactive

Nodemove is sent when the position of the menu changes.

Nodechange is sent when the items in the menu change.

Nodeselect is sent when the select state of the menu changes.

Nodeactive is sent when the active state of the menu changes.

 

Commands and Functions



activeget, activeset

active TF = activeget(node name $)
activeset(node name $, active TF)

Turn on or off the active state of the entire menu.

Inactive menus are drawn in gray, items are not selectable.

Individual items can be activated or deactivated with the itemactiveset property
See: itemactiveset, itemactiveget



boundsget, boundsset

rectangle $ = boundsget(node name $)
boundsset(node name $, rectangle $)

Get or set the boundary rectangle of the menu.



buttonopenget, buttonopenset

button open TF = buttonopenget(node name $)
buttonopenset(node name $, button open TF)

Get or set the buttonopen property for a button or combobox menu.

If true, the menu will pop open and display all of its items for mouse selection.




counticons, deleteicon, inserticon

total icons # = counticons(node name $)
deleteicon(node name $, icon index #)
inserticon(node name $, after index #)

These routines create, delete, and count icons for the given menu.

In general, you should insert and name an icon, import data for it, and set the icon name of a menu item to display.
See: itemiconset, itemiconget


countitems

total items # = countitems(node name $)

Returns the total number of items in the menu.



dataget, dataset

data $ = dataget(node name $)
dataset(node name $, data $)

Insert text file data into a menu, each carriage return will be a new item.

Dataget returns the text with a return at the end of each line.


deleteitem

deleteitem(node name $, item index #)

Deletes the given item.



deskcornerget, deskcornerset

desk corner TF = deskcornerget(node name $)
deskcornerset(node name $, desk corner TF)

Get or set the desk corner property for macintosh, crystal, and classic style menubars.

This is the round corner edge for menubars at the top of the desktop.

Turn this off if you are using the menubar somewhere else, like a window.



enabledget, enabledset

enabled TF = enabledget(node name $)
enabledset(node name $, enabled TF)

Get or set the enabled attribute of the menu. If enabled, the menu inverts selected items.
See: selectget, selectset



fillcolorget, fillcolorset

fill color $ = fillcolorget(node name $)
fillcolorset(node name $, fill color $)

Get or set the fill color, which is fill color for custom menus.



fontnameget, fontnameset

font name $ = fontnameget(node name $)
fontnameset(node name $, font name $)

Get or set the font name for a custom menu.



fontsizeget, fontsizeset

font size # = fontsizeget(node name $)
fontsizeset(node name $, font size #)

Get or set the font size for a custom menu.





fullget, fullset, infoget, infoset

full $ = fullget(node name $)
fullset(node name $, full $)
info $ = infoget(node name $)
infoset(node name $, info $)

Get or set XML data that describes all the settings for this node.

The fullget and fullset routines have a header element with appropriate namespaces, infoget and infoset are an XML snippet for access as a property. Example:

mynode.info.title = "new title"



gutterget, gutterset

text gutter # = gutterget(node name $)
gutterset(node name $, text gutter #)

Set the gutter, which is a border size for a custom menu. The gutter is inside the linesize.
See: linesizeset, leadingset



handlesget, handlesset

handles TF = handlesget(node name $)
handlesset(node name $, handles TF)

Turn on or off dragable handles for reshaping the node.

This routine is used by the system tool palettes for manual positioning.
See: markersget, markersset, partget, partset



hittest, hittestall

hit item index # = hittest(node name $, hor #, ver #)
hit item index # = hittestall(node name $, hor #, ver #)

Returns the index of the item clicked on, or zero if the mouse is not in an item.

Hittestall tests items even if they are inactive.



iconbinaryget, iconbinaryset

binary data $ = iconbinaryget(node name $, icon index #)
iconbinaryset(node name $, icon index #, binary data $)

Get or set binary data for any icon.

This routine is useful for serialization into xml and trading icons between nodes.



iconexport, iconimport

iconexport(node name $, icon index #, file name $)
iconimport(node name $, icon index #, file name $)

Import and export icon pictures. These are small 16 X 16 bitmapped images.



iconnameget, iconnameset

icon name $ = iconnameget(node name $, icon index #)
iconnameset(node name $, icon index #, icon name $)

Get and set the name of the icon. This should match the icon name in the item.


inparentitem

inside parent item TF = inparentitem(node name $, hor #, ver #)

This routine returns true if the point is in a menus parent item.

This is useful while tracking the mouse in a menubar with multiple pulldown menus and submenus.


insertitem

insertitem(node name $, after index #)

Inserts a new item after the given position. Use zero to insert at the beginning of the menu.



itemactiveget, itemactiveset

active TF = itemactiveget(node name $, item index #)
itemactiveset(node name $, item index #, active TF)

Get or set the active property of an item. Inactive items are drawn in gray and are not selectable.

The entire menu can be activated or deactivated with the activeset property.
See: activeset, activeget


itembounds

rectangle $ = itembounds(node name $, item index #)

Return the bounds of a given item.

An argument of zero will return the editing rectangle for a button or combobox menu.

This is useful for attaching a text node to a button or combobox menu.



itemcheckmarkget, itemcheckmarkset

check mark TF = itemcheckmarkget(node name $, item index #)
itemcheckmarkset(node name $, item index #, check mark TF)

Get or set the check mark property of a menu item. Checks are displayed to the left of the item.



itemcmdkeyget, itemcmdkeyset

command key $ = itemcmdkeyget(node name $, item index #)
itemcmdkeyset(node name $, item index #, command key $)

Get or set the name of a command key in an item.

Single letters are given "Ctrl+" on windows, modern, and custom menus, and the control symbol on macintosh, crystal, and classic menus.

Multiple letters print whatever you like in the control key part of the item.



itemdividinglineget, itemdividinglineset

dividing line TF = itemdividinglineget(node name $, item index #)
itemdividinglineset(node name $, item index #, dividing line TF)

Get or set the dividing line property of a menu item. Dividing lines cannot be selected.



itemdottedget, itemdottedset

dotted TF = itemdottedget(node name $, item index #)
itemdottedset(node name $, item index #, dotted TF)

Get or set the dotted property of a menu item. Dots are displayed to the left of the item, unless there is a check there.



itemfontstyleget, itemfontstyleset

font style name $ = itemfontstyleget(node name $, item index #)
itemfontstyleset(node name $, item index #, font style name $)

Get or set the font style of an item. Available styles include: plain, bold, italic, and underline.



itemhiliteget, itemhiliteset

item hilite $ = itemhiliteget(node name $, item index #)
itemhiliteset(node name $, item index #, item hilite $)

Get or set the hilite for each item, which draws a special border on the item showing mouse control.

Hilites include: thin, thick, gray, thick gray, dark, light, very dark, very light, and none.



itemiconget, itemiconset

icon name $ = itemiconget(node name $, item index #)
itemiconset(node name $, item index #, icon name $)

Get or set the icon name for a menu item. Menu icons are small 16 X 16 bitmapped images.
See: inserticon, deleteicon, counticons



itemleftcolorget, itemleftcolorset

color $ = itemleftcolorget(node name $, item index #)
itemleftcolorset(node name $, item index #, color $)

Get or set the item left color, which is either a check mark or the dot to the left of the menu.
See: itemdottedset, itemcheckmarkset



itemnameget, itemnameset

item name $ = itemnameget(node name $, item index #)
itemnameset(node name $, item index #, item name $)

Get or set the name of a menu item. Generally you will inset an item and then name it.



itemrefget, itemrefset

item ref # = itemrefget(node name $, item index #)
itemrefset(node name $, item index #, item ref #)

Get or set the item ref, which is a user definable number that sticks to the menu item.



itemrightcolorget, itemrightcolorset

color $ = itemrightcolorget(node name $, item index #)
itemrightcolorset(node name $, item index #, color $)

Get or set the item right color, which is either a command key or a submenu to the right of the menu.
See: itemsubmenuset, itemcmdkeyset



itemsubmenuget, itemsubmenuset

submenu name $ = itemsubmenuget(node name $, item index #)
itemsubmenuset(node name $, item index #, submenu name $)

Get or set the submenu property of the menu item. If set, the menu item displays a triangle indicating a submenu.

The submenu text should be the node name of another menu. Menubars should reference pulldowns, and pulldowns should reference submenus.

The default script will track menus together.



itemtextcolorget, itemtextcolorset

color $ = itemtextcolorget(node name $, item index #)
itemtextcolorset(node name $, item index #, color $)

Get or set the text color of a menu item.



leadingget, leadingset

text leading # = leadingget(node name $)
leadingset(node name $, text leading #)

Get or set the leading, which is extra pixels between items in custom menus.
See: linesizeset, gutterset



linecolorget, linecolorset

line color $ = linecolorget(node name $)
linecolorset(node name $, line color $)

Get or set the line color, which is line color for custom menus.



linesizeget, linesizeset

linesize # = linesizeget(node name $)
linesizeset(node name $, linesize #)

Get or set the line size, which is line border around custom menus.
See: gutterset, leadingset



markersget, markersset

markers TF = markersget(node name $)
markersset(node name $, markers TF)

Turn on or off the node outline to show selection.

This routine is used by the system tool palettes to show that a node is selected.
See: handlesset, handlesget, partget, partset


moveitem

moveitem(node name $, item index #, new index #)

Moves the item to a new position.



partget, partset

part # = partget(node name $, hor #, ver #)
partset(node name $, hor #, ver #, part #)

Get or set the points for an individual handle.
See: markersget, markersset, handlesset, handlesget



popopenget, popopenset

pop open TF = popopenget(node name $)
popopenset(node name $, pop open TF)

Get or set the popopen property.

If this property is true, button menus will pop open on the current item instead of dropping down.
See: typeset, typeget


position

position(node name $, parent item bounds $)

Position sets the bounds of the menu based on the rectangle of the parent.

If the menu type is menubar, the parent rect should be the desktop or window that contains the menubar.

If the menu type is pulldown, the parent rect should be the appropriate item bounds from a parent menu bar.

If the menu type is submenu, the parent rect should be the appropriate item bounds from a parent pulldown menu.
See: itembounds


reset

reset(node name $)

Resets the width and height of the menu to include all items. This is useful for resizing the menu after changes.



selectcolorget, selectcolorset

select color $ = selectcolorget(node name $)
selectcolorset(node name $, select color $)

Get or set the select color for selected menu items.

This color is only used as a theme color for macintosh style menus or a hilite color for custom menus.



selectget, selectset

item index # = selectget(node name $)
selectset(node name $, item index #)

Get or set the currently selected menu item, or zero for no item selected.

In button and combobox menus, the selected item is displayed.
See: enabledget, enabledset



selectnameget, selectnameset

item name $ = selectnameget(node name $)
selectnameset(node name $, item name $)

Get or set the currently selected item by name.

If no item is selected, selectnameget will return the empty string.

If selectnameset cannot find an item with the given name, all items are deselected.
See: selectset, selectget



styleget, styleset

style name $ = styleget(node name $)
styleset(node name $, style name $)

Get or set the style of the menu.

Available styles include: custom, macintosh, windows, classic, modern, crystal, and native.

The native style matches the appearance of the current operating system.

Many of the visual properties of custom menus can be individually edited.
See: typeget, typeset





titlehorget, titlehorset, titleverget, titleverset

title hor # = titlehorget(node name $)
titlehorset(node name $, title hor #)
title ver # = titleverget(node name $)
titleverset(node name $, title ver #)

Get or set the horizontal and vertical offset of all the item text in a custom menu.

The horizontal offset effects the left and right margins of the item.

The vertical offset cannot push the text past the leading area.



typeget, typeset

type name $ = typeget(node name $)
typeset(node name $, type name $)

Get or set the type of the menu.

Available types include: menubar, pulldown, submenu, button, and combobox.

You can attach pulldown menus to menubars, and submenus to pulldown menus.

Use the itemsubmenuset command to establish connections between the different menus.

Button menus can pop up to the current item or drop down below the menu, use the popopenset command to control their behavior.

Combobox menus are similar to button menus, but they always open downward and can be combined with a text edit field.
See: itemsubmenuset, itemsubmenuget, popopenset, popopenget