Complete Simple Menu Example; Assigning Keyboard Shortcuts To Menu Items - Adobe GoLive CS2 Programmer's Manual

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide

Complete simple menu example

Here is the complete Main.html file that defines a working
// Main.html file for Hello example
<html>
<head>
</head>
<body>
<script>
// define a handler for the menuSignal event
function doMenuItem(menuEvt) {
}
// register the handler for both menu items with the parent menu
function initializeModule() {
}
</script>
<!-- The Simple Menu ------------------->
<jsxmenubar>
</jsxmenubar>
</body>
</html>

Assigning Keyboard Shortcuts to Menu Items

You can assign a keyboard shortcut to a menu item dynamically at run time, using the
setShortCut
The item's handler is executed when the user presses all specified modifiers with the specified character.
For example:
menus['file'].items['btBrowse'].setShortCut('control+alt','o');
Modifier keys include shift , control , and alt . You can specify the single value control , or any two or
three values combined with a plus operator. All of these are legal values:
"control"
"control+shift"
"control+alt"
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<meta name="generator" content="Adobe GoLive 6">
<title>Menus Extension</title>
switch (menuEvt.target.name) {
case "doThis": Window.alert("You chose Do Something item.");
break;
case "doThat": Window.alert("You chose Do Something Else item.");
break;
default: Window.alert ("Something went wrong...");
}
menubar['Hello'].addEventListener( 'menuSignal', doMenuItem, true);
<jsxmenu title="Hello, GoLive!">
<jsxitem name="doThis" title="Do Something">
<jsxitem name="doThat" title="Do Something Else">
</jsxmenu>
function. This function takes as its arguments a modifier string and an alphabetic character.
Adobe GoLive CS2 SDK
menu.
Hello, GoLive!
Menus and Toolbars
45
menuItem
Object's

Advertisement

Table of Contents
loading

Table of Contents