InitMenuHandler and InitMenuHandlerNamespace
read/write properties have empty strings as default value. They are
used to specify function from the DHTML page script that will handle
window menu initialization notification. This notification is sent
when the user opens the window menu (not a shortcut menu) by clicking
on the menu bar or pressing the "menu" key (typically named Alt
on the keyboards). Function is called only on the first entrance in
the menu and is called again only if the user leaves the menu and then
activates it again.
This notification is useful if the application design makes it
easier to update menu items status at once - when the window menu is
about to be opened. For example application may want to enable/disable
some items or check/uncheck others. Function registered by using these
properties can do it according to the status of the page(s).
Syntax and description
external.InitMenuHandler - string - Read/Write. Specifies the
script function to be called to handle the notification. Only the
function name must be specified (no brackets or parameters). For
example:
external.InitMenuHandler = "MyInitMenuHandler";
In the page function should be defined as:
function MyInitMenuHandler() {
// Implementation ...
}
The property can be inspected by the script in order to
determine the currently registered handler.
external.InitMenuHandlerNamespace - string - Read/Write.
Specifies the namespace that holds the function specified in the InitMenuHandler
property. the string syntax is "namespacetype=namespacename".
Currently only frame is supported as namespace type. In case of
no frames property should be empty (i.e. care about it only if you
have frames). Example:
external.InitMenuHandlerNamespace = "frame=main";
If you have a FRAMESET with a frame called "main" or
IFRAME with that name.
Remarks
Depending on the design style of the application this property
can be useful or not. Some applications prefer to update their menus
step by step on any action as part of the action itself - others
prefer to do so by inspecting the status only when the menu is about
to be shown.
In general application that uses many different context menus
with items whose status may change as well as the items in the main
menu should avoid this method and do its status updates during the
actions. VarioMenu component supports menu references to be used in
different menu branches. If the context menus of the application are
scraps of the main menu (for example you may want to show the same
Edit menu that appears in the window menu if the user right
clicks in the document) then using these properties will be easiest
way for the most applications of that type. the same is true about
the applications that have window menu only.
If you have frames defined in a FRAMESET page in some cases it
could be easier to implement some of the menu handling functions in
that page including the handler of the init menu notification. Of
course such kind of implementation will require cross-frame
scripting.
Applies to: external
|