________________________________________________________________________ Chapter 15: The Message Box 277 ________________________________________________________________________ CHAPTER 15: THE MESSAGE BOX The message box is a communication gateway between HyperPAD and you. This chapter will explain how to use the message box to display messages, evaluate expressions like a calculator, and execute commands. DISPLAYING STATUS MESSAGES The message box is a window in which the pad displays status information and other messages. For example, in the DOS pad, when you click on a work file, HyperPAD displays a status message in the message box indicating that it is searching for programs. USING THE MESSAGE BOX AS A CALCULATOR The message box can also be used as a calculator. Any arithmetic expression typed into the message box is evaluated by HyperPAD and the result is placed in the message box. USING THE MESSAGE BOX TO EXECUTE PADTALK COMMANDS Commands typed in the message box are immediately executed by HyperPAD. Thus, you can observe the effects of a PADtalk command on the HyperPAD environment immediately. ________________________________________________________________________ Chapter 15: The Message Box 278 ________________________________________________________________________ THE MESSAGE BOX IS A POPUP WINDOW The message box, like the tool box, is a popup window that you can reposition anywhere on the screen using the mouse. HyperPAD remembers the last location of the message box. So the next time you run HyperPAD, the message box will be located in the same place. Below is a picture of the message box. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ ³ ³ **** The Printed Documentation has a picture or screen shot here **** ³ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ SHOWING THE MESSAGE BOX The message box can be hidden or shown while you are browsing or designing pads. If you're designing a pad and need to perform a quick calculation, you can show the message box, perform the calculation, and then hide the message box before continuing to design. Even though the message box is visible, all painting and object tools still function normally. If the message box is not in a convenient position, simply use the mouse to move it to another location on the screen. To view the message box: 1. Select the Message Box command from the Workspace menu (ALT+W,M). The shortcut for this command is F4. When the message box is displayed, the Message Box command on the Workspace menu will be checked. 2. When you initially show the message box, the cursor is positioned for you to begin typing. If you want to skip typing, press TAB to move the focus to an object. ________________________________________________________________________ Chapter 15: The Message Box 279 ________________________________________________________________________ HIDING THE MESSAGE BOX When you're done with the message box, you can hide it. To hide the message box with the keyboard: Select the Message Box command from the Workspace menu (ALT+W,M). The shortcut for this command is F4. By pressing F4, you can quickly show and hide the message box. To hide the message box with the mouse: Click on the close box in the upper left corner. MOVING THE MESSAGE BOX You can only change the location of the message box if you have a mouse. To move the message box with the mouse: 1. Position the mouse on one of the borders of the message box. 2. While pressing the left mouse button, drag the message box to a new location. 3. Release the left mouse button. EDITING THE MESSAGE BOX This section describes the message box editing keys. 0 If the message box is not displayed, press F4 to show it. This automatically positions the cursor within the message box ready for you to begin typing. 0 If the message box is already displayed, press ALT+F4 to put the cursor in it. 0 If you have a mouse, click in the message box to place the cursor there. ________________________________________________________________________ Chapter 15: The Message Box 280 ________________________________________________________________________ The following table describes the editing keys available when working with the message box. To: Press: ------------------------------------------------------------------ Erase the contents of the message box CTRL+D, CTRL+Y Continue browsing without executing any commands TAB Move the cursor to the beginning of the line HOME Move the cursor to the end of the line END Move the cursor left one character Left arrow key Move the cursor right one character Right arrow key Cycle through list of executed commands Up/Down arrow keys Delete the character to the left of the cursor BACKSPACE USING THE MESSAGE BOX AS A CALCULATOR The message box provides a quick and easy way to perform calculations. The result of a calculation is placed in the message box. TYPING IN AN EXPRESSION For example, suppose you need to know the number of seconds in a day: 1. Press ALT+F4 to position the text cursor within the message box. 2. Type 60*60*24 into the message box. 3. Press ENTER. The result of the calculation (86400) will be placed in the message box. ________________________________________________________________________ Chapter 15: The Message Box 281 ________________________________________________________________________ EXPRESSION OPERATORS HyperPAD recognizes many operators that you can use within expressions. The following table contains some of the more common operators and examples of their use. (For a complete listing of operators, see the PADtalk Reference Guide.) Operator: Example: Result: -------------------------------------------------------- ^ (exponentation) 2^4 16 / (division) 21/7 3 * (multiplication) 3*4 12 - (subtraction) 6-2 4 + (addition) 3+4 7] OPERATOR PRECEDENCE HyperPAD normally evaluates expressions from left to right. Some operators, however, are evaluated before others. For example, the expression 2+3*4 evaluates to 14 (not 20) because the multiplication operator has precedence over the addition operator. The table above listed the operators in the order of highest to lowest precedence. To change the order of evaluation, use parenthese: Expression: Result: ---------------------------- 2+3*4 14 (2+3)*4 20 ________________________________________________________________________ Chapter 15: The Message Box 282 ________________________________________________________________________ FUNCTIONS HyperPAD also understands functions in expressions. For example, the expression 5+sin(90) uses the built-in HyperPAD function called sin(). Functions often take parameters, such as the sin() function. The following table lists a few of HyperPAD's built-in functions. (For a complete listing, refer to the PADtalk Reference Guide.) Function: Example: Returns: ------------------------------------------------------- sin() sin(90) 1 cos() cos(45) 0.707107 tan() tan(30) 0.57735 directory() directory() "C:\HPAD2" diskSpace() diskSpace() 6554012 date() date() "5/12/90" You can incorporate functions into your expressions, as in the following examples: 8 * sin(30) / .4 diskSpace() - 35640 TYPING COMMANDS INTO THE MESSAGE BOX In addition to calculatorlike expressions, you can type commands into the message box. Commands are actually "words" in the PADtalk vocabulary that direct HyperPAD to perform some action. Typing commands into the message box allows you to experiment with PADtalk and immediately observe the effects the commands have on the HyperPAD environment. To type a command into the message box: 1. Press ALT+F4 to position the text cursor in the message box. If the message box is hidden, this command makes it visible. 2. Type your command in the message box. 3. Press ENTER. If you want to execute the same command more than once, press CTRL+ENTER. ________________________________________________________________________ Chapter 15: The Message Box 283 ________________________________________________________________________ Since you can only enter one command at a time, there is no need to type a semicolon at the end of the line. The most common PADtalk commands are described in the following section. (For a complete listing, see the PADtalk Reference Guide.) THE GO COMMAND You can use the go command to navigate to any other page or pad in the HyperPAD environment. The following are examples: go home go help go to pad "phone" go to pad "ideas" go to page 4 go to page "Preferences" THE DIAL COMMAND The dial command uses a Hayes-compatible modem to dial the phone. The following are some examples that you can type into the message box: dial "3154743400" dial "18005551212" When dialing the phone, HyperPAD displays a message indicating that the phone is being dialed. After dialing is completed, a dialog box will instruct you to pick up the phone. When you select <>, the modem will disconnect from the line, allowing you to talk. ________________________________________________________________________ Chapter 15: The Message Box 284 ________________________________________________________________________ THE FIND COMMAND The find command helps you locate information anywhere in your pad. Some examples of what you can type into the message box are: find part "lawyer" find part "John" in field "Name" find whole "Smith" in field "Last Name" The text that you want to find is enclosed within quotes. The words part and whole specify whether you want to find the text as part of another word or as a whole word. While HyperPAD is searching, a message is displayed to indicate a find is in progress. If the search is successful, the found text will be highlighted. If the search is unsuccessful, HyperPAD will beep twice. THE SET COMMAND The set command allows you to change an object's properties. Normally, you change an object's properties using the Info dialog boxes. However, a few object properties can only be assigned by with the set command. REFERING TO AN OBJECT To use the set command to change a property of an object, you must reference a specific button or field on either the page or background. Specifically, you need to know: 0 The object type--whether the object is a button or a field. 0 The ID of the object. You can determine the ID of a button or field by looking at either the Button Info or Field Info dialog boxes. The ID is listed below the name. 0 Whether the object is on the page or the background. To determine an object's reference information: 1. Use the Selector tool and TAB until the button or field you want to change is selected. 2. Press ENTER to view the Info dialog box. Note the object's ID and position (whether the object is on the page or background). ________________________________________________________________________ Chapter 15: The Message Box 285 ________________________________________________________________________ ALIGNING A BUTTON'S NAME The Align property determines whether a button's name is aligned left, right, or centered. For fields, this property is set from the Field Info dialog box. For buttons, however, this property can only be assigned with the set command. To change the alignment of the button's name: 1. Press ALT+F4 to edit the contents of the message box. 2. Type one of the following commands replacing the number 4 with the ID of your button. Replace the word "page" with "background" if the button is on the background: set the align of page button id 4 to left set the align of page button id 4 to right set the align of page button id 4 to centered LOCK TEXT (BUTTONS) The Lock Text property specifies whether an object can be given the focus. Locked buttons cannot be clicked on with the mouse or highlighted using the TAB key. Locked fields cannot be edited or scrolled. For fields, this property is set from the Field Info dialog box. For buttons, however, this property can only be set from the message box. To change the Lock Text property of a button: 1. Press ALT+F4 to edit the contents of the message box. 2. Type in a command similar to one of the following: set the lockText of page button 4 to true set the lockText of background button 4 to true THE HIDE AND SHOW COMMANDS Buttons and fields are normally visible, allowing users to TAB to different objects; type into fields, and select buttons. The hide command makes an object invisible on the page or background. However, the hide command doesn't delete the object, it simply hides it from view. The show command makes the hidden object visible. ________________________________________________________________________ Chapter 15: The Message Box 286 ________________________________________________________________________ In the Phone pad, for example, you may not have an immediate need for the Fax Phone field, but you want to keep it around for future use. Instead of deleting the field, simply hide it. To hide a button or field: 1. Press ALT+F4 to activate the message box. 2. For buttons, type one of the following commands, replacing the number 4 with the ID of your button: hide page button id 4 hide background button id 4 For fields, type one of the following commands: hide page field id 4 hide background field id 4 To show a button or field: show page button id 4 show background field id 4 ADVANCED COMMANDS Use the following examples to perform advanced functions with the message box. You can enhance these commands with skills learned in this chapter. In some cases, you'll need to replace the information contained in the command with data specific to your pad. Each command can be typed into the message box and executed by pressing ENTER. If the command is longer than the width of the message box, the message box will scroll horizontally to accommodate a longer line. To hide all of the buttons on a page: for i = 1 to the number of page buttons do hide page button i To sort the pad using a field as a sort key: sort by field 1 ________________________________________________________________________ Chapter 15: The Message Box 287 ________________________________________________________________________ To run another program: run "c:\word5\word" To place a bookmark on the current page: push this page To return to a bookmarked page: pop page To display a Show Partner F/X presentation: fxshow "C:\FX\SHOWS\ANIMATE.PRO" To change the location of the message box: set the location of the message box to 4,4 CONCLUSION This chapter introduced the message box, the gateway between you and HyperPAD. You've learned how to display the message box, move it around the screen using a mouse, and hide it when you'rr done. The message box can be used as a calculator or as a way of immediately executing statements so that you can observe their effects on the HyperPAD environment. This chapter also introduced you to some PADtalk commands that you can use from the message box. You were shown how to modify object properties that don't appear in the Info dialog boxes by using these commands.