Previous Book Contents Book Index Next

Inside Macintosh: Apple Guide Complete / Part 4 - Scripting Guide Files
Chapter 10 - Guide Script Command Reference / Guide Script Command Descriptions
/ Creating Buttons

<Standard Button>

You can use the <Standard Button> command to place a standard 2D button on a panel. You must specify the button's title, its location on the panel, and the event function that Apple Guide calls when the user clicks the button.

<Standard Button> buttonTitle, buttonLoc, buttonEvent [, buttonFont]
A string specifying the button's title.
A constant specifying either the button's general location or its coordinates relative to the current pen location.
To describe a button's coordinates, use the Point function. The current pen location's horizontal coordinate is the left edge of the current format; its vertical coordinate corresponds to the bottom edge of the last object not specifically placed using coordinates.
You can also use these constants to describe the button location:
If you specify one of these constants, Guide Maker justifies the button accordingly within the current format.
A name of an event function or event list. Include any parameters expected by the function in parentheses following its name. You define event functions using the <Define Event> or <Define Event List> command. Guide Maker also provides built-in functions that you can specify in this parameter. When the user clicks the button, Apple Guide calls the function defined by this parameter; usually such a function is used to send a specific Apple event.
A constant specifying the font of the button's title. You can use either of these constants to specify the corresponding font:
Specifies 10-point Espy Serif.
Specifies the system font of the current script system. For example, for Roman script systems, indicates 12-point Chicago.
This parameter is optional; if you omit this parameter Apple Guide displays the button title in the font of the current script system.
The <Standard Button> command places a button with the specified title on a panel. Apple Guide performs the action indicated by the buttonEvent parameter when the user clicks the button. When you specify a button using the <Standard Button> command, Guide Maker creates a button that is 20 pixels high with a minimum width of 59 pixels (the width of a standard OK button). Guide Maker sizes the button to fit the button's title (the width of the text plus 10 pixels on each side).

Buttons appear inline with the surrounding text and are positioned within the current format. You can specify the button's location generally, using the constants LEFT, CENTER, or RIGHT. If you specify one of these constants, Guide Maker positions the button in the current format, and left-justifies, right-justifies, or centers the button, accordingly. You can also specify the button's location relative to the current pen position by specifying a specific point. For example, if you specify the button location as Point(50,100), Guide Maker positions the button 50 pixels to the right and 100 pixels down from the current pen location.

#define doButton1Action as an event function that sends to 
# the app with signature 'WAVE' (SurfWriter) the Apple event
# defined by event class 'sfwr' and event ID 'act1'
<Define Event> "doButton1Action", 'WAVE', 'sfwr', 'act1'

#define doButton2Action as an event function
<Define Event> "doButton2Action", 'WAVE', 'sfwr', 'act2'

<Define Panel> "Example Panel"
   #place "Create Book Index" button right-justified on panel
   <Standard Button> "Create Book Index", RIGHT, doButton1Action()

   #place "Create Chapter Index" button relative to the current
   # pen location, that is,
   # 50 pixels to the right, 100 pixels down 
   <Standard Button> "Create Chapter Index", Point(50,100), �
<End Panel>
For information on using formats when placing buttons, see "Formatting Text and Objects in a Panel" beginning on page 10-84. For information on the <Define Event> and <Define Event List> commands, see page 10-178 and page 10-181, respectively. For information on creating radio buttons and checkboxes, see the descriptions of the <Radio Button> and <CheckBox> commands on page 10-64 and page 10-69, respectively. The <3D Button> command is described next.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
12 JUL 1996