Product Documentation
Cadence User Interface SKILL Reference
Product Version IC23.1, September 2023

hiCreateMenuItem

hiCreateMenuItem(
?name s_itemHandle 
?itemText t_menuItemText 
[ ?itemIcon g_menuIcon ] 
[ ?callback t_itemCallback ]
[ ?disable g_disabled ] 
[ ?statusTip t_statusTip ]
[ ?font t_font ]
) 
=> r_hiMenuItem

Description

Creates a menu item that can be used in any type of menu, except two-dimensional menus and simple menus.

The menu item should contain text t_menuItemText and optionally an icon g_menuIcon to be displayed adjacent to the text. Also, the menu item can have a SKILL callback procedure associated with its selection (t_itemCallback).

If an action was created with a callback of the same name as the callback for this function, and if an icon was specified for the action, then that icon is used for this menu item. Otherwise, the icon you specify is used. The menu item can also have an access key or shortcut. Pressing this key selects the menu item.

You can use the same menu item in multiple menus.

The menu item created with this function is a non-slider entry, that is, it cannot display a submenu. Use hiCreateSliderMenuItem to create slider items and use hiCreateSeparatorMenuItem to create separators.

Arguments

?name s_itemHandle

SKILL handle to the menu item.

?itemText t_menuItemText

String representing text for the menu item.

To set an access key for the menu item, add an ampersand (&) before the desired letter. For example, if the menu item is Replace and you want P to be the access key, you would specify this argument as "Re&place".

In pulldown and popup menus, an icon is displayed automatically with the text menu item if t_menuItemText begins with one of the following strings:

"Load"

"Open"

"Close"

"Save As"

"Undo"

"Redo"

"Exit"

"Print"

If you do not want to display the default icon in the menu, add the following variable to your .cdsenv file:

ui useAutoPixmaps boolean nil

?itemIcon g_menuIcon

List representing an icon menu item. The icon occupies the icon area on the left of the menu item, and the text (specified in t_menuItemText) is displayed alongside.  Menu icons can only be 16x16 pixels in size. If the icon is larger than 16x16 pixels, it gets shrunk (which is why only 16x16 icons are recommended for the menu items).

If an action was created with a callback of the same name as the callback for this function, and if an icon was specified for the action, then that icon is used for this menu item. Otherwise, the icon you specify for this argument is used.

?callback t_itemCallback

String that represents a SKILL callback procedure to be executed when that menu item is selected.

?disable g_disabled

Disables the menu item, grayed out and unselectable, when displayed.

?statusTip t_statusTip

The status text is displayed in the status bar at the bottom of the window when the mouse hovers over the menu item. If you do not specify this argument, the item text (t_menuItemText) is displayed.

To set the status tip after the menu is instantiated, you can use the hiSetMenuItemStatusTip function.

?font t_font

This argument is ignored.

Value Returned

r_hiMenuItem

The SKILL structure representing the menu item. The item handle and text menu item can be referenced by menuItem->hiMenuItemSym and menuItem->hiItemText respectively.

Examples

Creates two menu items as One and Two.

trMenuItemOne = hiCreateMenuItem(
 ?name ’trMenuItemOne
 ?itemText "One"
 ?callback "println( \"One\" )"
 )
trMenuItemTwo = hiCreateMenuItem(
 ?name ’trMenuItemTwo
 ?itemText "Two"
 ?callback "println ( \"Two\" )"
 )

Adds a new entry, Library Browser, to the CIW. It looks for the Library Manager entry in all the menus of the CIW, and adds an entry for the Library Browser immediately after it.

let( ((ciwBannerMenus hiGetBannerMenus(window(1))) toolMenu
pdItem menuList found libBrowser)
while(ciwBannerMenus
pdItem = eval(car(ciwBannerMenus))
ciwBannerMenus = cdr(ciwBannerMenus)
menuList = pdItem ->_menuItemList
while(menuList
menuItem = car(menuList)
menuList = cdr(menuList)
when(menuItem == ’LibMan
found = t
menuList = nil
ciwBannerMenus = nil
)
)
)
when( found
libBrowser = hiCreateMenuItem(
?name ’LibBrowser
?itemText "Library Browser..."
?callback "dmbOpenLibDAGBrowser()"
)
hiInsertMenuItem(pdItem libBrowser ’LibMan)
)
)

Related Topics

Menu Functions

hiAddMenuItem

hiCreateSeparatorMenuItem

hiCreateSliderMenuItem

hiDeleteMenuItem

hiDisableMenuItem

hiEnableMenuItem

hiGetMenuItems


Return to top
 ⠀
X