Initializing Menu Items - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide
are enabled by default. You do not need to set enabled to true unless you have previously disabled the
item.
This figure show an enabled menu item, which is drawn in black and can be chosen by the user, and a
disabled menu item, which is drawn in gray and cannot be chosen by the user.
This example creates these menu items, and a menuSetup event handler sets a menuItem object's
enabled property explicitly to disable it.
<!-- Enable/Disable Example ------------------->
<jsxmenubar>
<jsxmenu name="myMenu" title="MyUniqueMenuName">
</jsxmenu>
</jsxmenubar>
<script>
. . .
function initializeModule() {
menubar['myMenu'].items['disableItem'].addEventListener( 'menuSetup',
}
. . .
</script>
This script accesses the MyMenu menu and the disableItem menu item in the global namespace to
register the handler that sets the enabled property.

Initializing menu items

You can specify an initial checked or enabled state for a menu item, if you specify that the item is dynamic.
The optional dynamic attribute of the <jsxitem> tag marks its menu item as one that GoLive initializes
before displaying the menu. This attribute takes no value; if it is present, the item is initialized. You provide
the initialization behavior by implementing an event handler for the
with the dynamic menu item.
Each time the user opens a menu defined by an extension, GoLive triggers the menuSetup event, and
calls any handler function that is registered for each of the items that provide the dynamic attribute. The
handler can then initialize the item for display, setting, for example, its checked and enabled states, and its
initial value.
In this example, both menu items require dynamic initialization.
<jsxmenubar>
<jsxmenu name="BGColr" title="Background">
</jsxmenu>
</jsxmenubar>
active or enabled, can be selected
inactive or disabled, cannot be selected
<jsxitem name="enableItem" value="Enabled">
<jsxitem name="disableItem" value="Disabled">
function(e){ e.target.enabled = false; });
<jsxitem name="bgcolred" title="Set BG Red" dynamic>
<jsxitem name="bgcolgrn" title="Set BG Green" dynamic>
Adobe GoLive CS2 SDK
Menus and Toolbars
menuSetup
event, and registering it
47

Advertisement

Table of Contents
loading

Table of Contents