 |
Please Note:
HierMenus is protected by copyright laws. Use of the HierMenus code requires a paid licensing agreement.
|
|
 |

|
 |
 |
|
home / documentation / reference / hm_oncreatemenu
HM_OnCreateMenu
- Description:
- The custom (user defined) method that is called just
prior to the creation of a menu (that is, just before the menu's
HTML element is created).
- Value:
- JavaScript function.
- Applies To:
- Menus.
- Browser Compatibility:
- HM_OnCreateMenu is supported in all browsers.
- Parameters:
- None.
- Comments:
- HM_OnCreateMenu is a HierMenus Menu Event Hook; a
means for you to execute your own custom JavaScript code from within normal
HierMenus processing. All menu event hooks expect to be set to the name of
a custom function (typically of your own creation, although the HM_Loader.js
file contains some custom functions designed for use with event hooks), a
function literal, or a dynamically generated function.
The function you create for use with this menu event hook should be designed
as a method of the menu object, i.e., the internal menu object that HierMenus
creates to track the various unique parameters of the menu itself. Thus, the
this keyword, within the context of your custom function, refers
directly to the menu object.
The menu object (referred to by this) is not the
same as the menu element. The menu object is the internal structure
that HierMenus uses to track various pieces of information specific to this
menu. The menu element is the actual HTML page element that represents
the menu itself. You access the menu object via the this keyword
within your custom method. In HM_OnCreateMenu you cannot access the
menu element because it has not yet been created.
For further usage and implementation information, see the mini-tutorial
Menu Event Hooks.
- Example Method:
// write a message to the status bar
// describing the creation of a menu
function HM_fc_CreateMenu() {
window.status=this.MenuID+" is being created.";
}
- Example Settings:
// Ok:
HM_OnCreateMenu:HM_fc_CreateMenu,
HM_OnCreateMenu:null, // remove hook for this menu
// Incorrect:
HM_OnCreateMenu:"HM_fc_CreateMenu",
// do not quote function names here
HM_OnCreateMenu:"null",
// do not quote null here
- Default:
- null
- See Also:
-
HM_OnMove,
HM_OnVisibilityToggle,
HM_OnMenuCreated,
HM_OnItemHilite,
HM_OnBuildMenus,
HM_OnItemClick,
HM_OnItemHover,
HM_OnCreateItem,
HM_OnItemCreated,
HM_OnMenuOver,
HM_OnMenuOut,
HM_OnItemOver,
HM_OnItemOut,
HM_OnLink,
setTrans,
killTrans,
Menu Event Hooks Mini-Tutorial
|
|