Menus And Toolbars; Creating Custom Menus; Basic Example - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

4

Menus and Toolbars

This chapter describes how you can use the GoLive CS2 SDK to add menus and menu items to the GoLive
menu bar and context menus, and add toolbars to the GoLive main toolbar.
Note:
This chapter does not describe pop-up menus, which are controls that appear in dialog windows.
For information on popup menus, see
To create a custom menu in the GoLive menu bar, your extension defines the menu and menu items,
and defines and registers event handlers which GoLive calls when the user chooses a menu item. You
can add submenus, enable and disable a menu programmatically, and check and uncheck menu items.
You can also add menu items to the predefined menus in the GoLive menu bar.
The GoLive CS2 SDK provides limited access to some of GoLive's context menus. Your extension can
define an event handler for a context menu that extends that menu by adding submenus or menu
items. See
Similarly, to create a toolbar, your extension defines the toolbar and its controls (typically buttons with
icons), and defines and registers event handlers for the controls. See

Creating Custom Menus

You can add a custom menu to the GoLive menu bar in your extension definition (the Main.html file)
using the three menu SDK tags. To create a custom menu or menu item when your extension is loaded,
place these tags in an extension's Main.html file:
One
<jsxmenubar>
GoLive menu bar.
The
<jsxmenu>
menu bar.
The
<jsxitem>
GoLive adds custom menus to the menu bar at the left of the Window menu. You cannot specify the order
in which GoLive loads multiple custom menus. However, the items in a menu always appear in the order
the Main.html file defines them.
Your script can also add menu items and submenus to existing menus at run time, using a
addItem
and returns the menu or menuItem object as well as modifying the existing menu. For an example that
creates both a submenu and its menu items, see
When the user chooses a menu item, GoLive generates a
target. Your extension must define a menuSignal handler to implement the behavior of your menu item,
and register it for with the menuItem object. GoLive calls this function whenever the user chooses the
item for which it is registered.

Basic example

This example defines the custom menu shown below:
<jsxmenubar> // opens definition of all menus
Extending Context Menus
binary tag per Main.html file surrounds all the other tags that add menus to the
tag defines a custom menu that appears to the left of the
tag defines a custom menu item that appears in a custom menu.
or
function. The
addChild
"Adding Controls to Windows" on page
below.
function can add either an item or a submenu; it creates
addChild
"Context menu example" on page
menuSignal
66.
Creating Toolbars
below.
menu in the GoLive
Window
menu
51.
with that
menuItem Object
Object's
as its
40

Advertisement

Table of Contents
loading

Table of Contents