Using the Rational Rose Script Editor
ContentsThis chapter is organized as follows:
- The Rose Script Editor
- The Script Editor Window
- Opening a Script
- Creating New Rose Scripts
- Selecting a Font for the Script Editor
- Moving the Insertion Point in a Script
- Selecting Text
- Deleting, Cutting, Copying, and Pasting Text
- Adding Comments to a Script
- Finding and Replacing Text
- Running, Pausing, and Stopping Your Script
- Tracing Script Execution
- Setting and Removing Breakpoints
- Working with Watch Variables
- Compiling Your Script
- Using Interscript Calls
- Working with the Dialog Editor
The Rose Script EditorThe Rational Rose Script Editor provides an integrated environment for creating, debugging, and compiling scripts that work with the Rose Extensibility Interface.
The Script Editor WindowFigure 7 shows the Script Editor application window.
Figure 7 Rose Script Editor
The Script Editor's application window contains the following elements:
- Toolbar: a collection of tools that you can use to provide instructions to the Script Editor
- Edit pane: a window containing the source code for the script you are currently editing
- Watch pane: a window that opens to display the watch variable list after you have added one or more variables to that list
- Pane separator: a divider that appears between the edit pane and the watch pane when the watch pane is open
- Status bar: displays the current location of the insertion point within your script
Opening a ScriptTo open a script in the Script Editor:
- 1 Click Tools > Open Script.
- 2 Select the script to open and select OK.
Creating New Rose ScriptsCreating a New Script from Scratch
To create a new script in the Script Editor:
- 1 Click Tools > New Script.
- 2 Enter your script in the new Script Editor window.
- 3 Enter your script text.
- 4 Click File > Save As and save the new script.
Creating a New Script from an Existing Script
To create a new script from an existing script:
- 1 Click Tools > Open Script.
- 2 Select a file from the list of available scripts.
- 3 Click OK to enter the Script Editor and display the script.
- 4 Select the script text and click Copy to save the script text to the Clipboard.
- 5 Click Tools > New Script.
- 6 Click Paste to paste the existing script text into the new script window.
- 7 Click File > Save As and save the new script.
Selecting a Font for the Script EditorWhen you create a new script or edit an existing script, you can select the text font in the Watch and Edit panes of the Script Editor window.
To select a font for the Script Editor:
- 1 To make sure the Script Editor window has the focus, do one of the following:
- Create a new script (Tools > New Script).
- Edit an existing script (Tools > Open Script).
- Click on an already open Script Editor window.
- 2 Click Edit > Font to display the Font dialog box.
- 3 Select the font, font style, size, and script. (For information about each option, click the question mark, and then click the option.)
- 4 Click OK.
Moving the Insertion Point in a ScriptThere are two ways to move the insertion point in a script:
- With the mouse
- By specifying a line number
Moving the Insertion Point with the Mouse
This approach is useful when the area of the screen to which you want to move the insertion point is currently visible.
To move the insertion point with the mouse:
- 1 Use the scroll bars at the right and bottom of the display to scroll the target area of the script into view if it is not already visible.
- 2 Place the mouse pointer where you want to position the insertion point.
- 3 Click the left mouse button.
Note: When you scroll the display with the mouse, the insertion point remains in its original position until you reposition it with a mouse click. If you attempt to perform an editing operation when the insertion point is not in view, the Script Editor automatically scrolls the insertion point into view before performing the operation.
Moving the Insertion Point to a Specified Line in Your Script
This approach is useful when the area of the screen to which you want to move the insertion point is not currently visible but you know the number of the target line.
To move the insertion point to a specified line:
Figure 8 Goto Line Dialog Box
- 2 Enter the number of the line in your script to which you want to move the insertion point.
- 3 Click OK or press ENTER.
- 4 The insertion point is positioned at the start of the line you specified. If that line was not already displayed, the Script Editor scrolls it into view.
Note: The insertion point cannot be moved so far below the end of a script as to scroll the script entirely off the display. When the last line of your script becomes the first line on your screen, the script will stop scrolling, and you will be unable to move the insertion point below the bottom of that screen.
Selecting TextThere are three ways to select text in an open script:
- With the mouse
- With the keyboard
- By selecting an entire line
Selecting Text with the Mouse
To use the mouse to select text in your script:
- 1 Place the mouse pointer where you want your selection to begin.
- 2 Do one of the following:
Figure 9 Selected Script Text
Selecting Text with the Keyboard
To use keyboard shortcuts to select text in your script:
- 1 Place the insertion point where you want your selection to begin.
- 2 While pressing SHIFT, use one of the navigating keyboard shortcuts to extend the selection to the desired ending point.
Selecting an Entire Line
To use the keyboard to select one or more whole lines in your script:
- 1 Place the insertion point at the beginning of the line you want to select.
- 2 Press SHIFT + DOWN ARROW.
- 3 To extend your selection to include additional whole lines of text, repeat step 2.
Deleting, Cutting, Copying, and Pasting TextDeleting Text
Do one of the following to remove characters, selected text, or entire lines from your script:
- To remove a single character to the left of the insertion point, press BACKSPACE once.
- To remove a single character to the right of the insertion point, press DELETE once.
- To remove multiple characters, hold down BACKSPACE or DELETE.
- To remove text that you have selected, press BACKSPACE or DELETE.
- To remove an entire line, place the insertion point in that line and press CTRL+Y.
Cutting a Selection
To cut text from your script and place it on the Clipboard, press CTRL+X.
Copying a Selection
To copy text from your script and place it on the Clipboard, press CTRL+C.
Pasting the Contents of the Clipboard into Your Script
To paste the contents of the Clipboard into your script:
- 1 Position the insertion point where you want to place the contents of the Clipboard.
- 2 Press CTRL+V.
Adding Comments to a ScriptThere are two types of comments you can add to a script:
- Full-Line Comment
- Comment at the End of a Line of Code
Adding a Full-Line Comment
To designate an entire line as a comment:
- 1 Type an apostrophe ( ' ) at the start of the line.
- 2 Type your comment following the apostrophe.
When your script is run, the presence of the apostrophe at the start of the line will cause the entire line to be ignored.
Adding a Comment at the End of a Line of Code
To designate the last part of a line as a comment:
- 1 Position the insertion point in the empty space beyond the end of the line of code.
- 2 Type an apostrophe ( ' ).
- 3 Type your comment following the apostrophe.
When your script is run, the code on the first portion of the line will be executed, but the presence of the apostrophe at the start of the comment will cause the remainder of the line to be ignored.
Finding and Replacing TextFinding Specified Text
To locate instances of specified text quickly anywhere within your script:
- 1 Move the insertion point to where you want to start your search. To start at the beginning of your script, press CTRL+HOME.
- 2 Press CTRL+F.
Figure 10 Find Dialog Box
- 3 In the Find what box, specify the text you want to find or select it from the list of previous searches.
- 4 Click Find Next or press ENTER.
The Find dialog box remains displayed, and the Script Editor either highlights the first instance of the specified text or indicates that it cannot be found.
- 5 If the specified text has been found, repeat step 4 to search for the next instance of it.
Note: If the Find dialog box blocks your view of an instance of the specified text, you can move the dialog box out of your way and continue with your search.
- 6 To remove the Find dialog box while maintaining the established search criteria, click Cancel.
- 7 Press F3 to find successive occurrences of the specified text.
Note: If you press F3 when you have not previously specified text for which you want to search, the Script Editor displays the Find dialog box so you can specify the desired text.
Replacing Specified Text
To automatically replace either all instances or selected instances of specified text:
- 1 Move the insertion point to where you want to start the replacement operation. To start at the beginning of your script, press CTRL+HOME.
- 2 Click Edit > Replace.
Figure 11 Replace Dialog Box
- 3 In the Find what box, specify the text you want to replace or select it from the list of previous searches.
- 4 In the Replace with box, specify the replacement text or select it from the list of previous replacements.
- 5 To replace selected instances of the specified text, click Find Next.
The Script Editor either highlights the first instance of the specified text or indicates that it cannot be found.
- 6 If the specified text has been found, either click Replace to replace that instance of it or click Find Next to highlight the next instance (if any).
Running, Pausing, and Stopping Your ScriptRunning Your Script
To compile and run your script from within the Script Editor, click Go on the toolbar or press F5.
The script is compiled (if it has not already been compiled), the focus is switched to the parent window, and the script is executed.
Note: During script execution, the Script Editor's application window is available only in a limited manner. Some of the menu commands may be unavailable, and the toolbar tools may be inoperative.
You can also use the Application Class ExecuteScript method to run scripts. See the online Help for details.
Pausing an Executing Script
To suspend the execution of a script that you are running, press CTRL+BREAK.
Execution of the script is suspended, and the instruction pointer (a gray highlight) appears on the line of code where the script stopped executing.
Note: The instruction pointer designates the line of code that will be executed next if you resume running your script.
Stopping an Executing Script
To stop the execution of a script that you are running:
- 1 If it is not paused, pause the script.
- 2 Click StopDebugging on the toolbar or press SHIFT+F5.
Note: Many of the functions of the Script Editor's application window may be unavailable while you are running a script. If you want to stop your script, but find that the toolbar is currently inoperative, press CTRL+BREAK to pause your script, then click StopDebugging.
Tracing Script ExecutionStepping Through Your Script
To trace the execution of your script with either the StepInto or StepOver method:
- 1 Do one of the following:
- Click StepInto or StepOver on the toolbar.
- Press F11(StepInto) or F10 (StepOver).
Note: When you initiate execution of your script using either of these methods, the script will first be compiled, if necessary. Therefore, there may be a slight pause before execution actually begins. If your script contains any compile errors, it will not be executed. To debug your script, first correct any compile errors, and then execute it again.
- 2 To continue tracing the execution of your script, repeat step 1.
Each time you repeat step 1, the Script Editor executes the line or the procedure that contains the instruction pointer and then moves the instruction pointer to the next line or procedure to be executed.
- 3 When you finish tracing the execution of your script, either click Go on the toolbar (or press F5) to run the script at full speed or click Stop Debugging to halt execution of the script.
Displaying the Calls Dialog Box
When you are stepping through a subroutine, you may need to determine the procedure calls by which you arrived at that point in your script.
To use the Calls dialog box to obtain this information:
- 1 Click Calls on the toolbar.
Figure 12 Script Calls Dialog Box
- 2 Select the name of the procedure you wish to view.
- 3 Click Show.
Setting and Removing BreakpointsYou set and remove breakpoints in your script as part of the debugging process.
Starting Debugging Partway Through a Script
To begin the debugging process at a selected point in your script:
- 1 Place the insertion point in the line where you want to start debugging.
- 2 To set a breakpoint on that line, click Toggle Breakpoint on the toolbar or press F9.
- 3 Click Go on the toolbar or press F5.
The Script Editor runs your script at full speed from the beginning and then pauses prior to executing the line containing the breakpoint. It places the instruction pointer on that line to designate it as the line that will be executed next when you either proceed with debugging or resume running the script.
Continuing Debugging at a Line Outside the Current Subroutine
You can continue debugging at a line that is not within the same subroutine.
To move the instruction pointer to that line:
- 1 Place the insertion point in the line where you want to continue debugging.
- 2 To set a breakpoint on that line, click Toggle Breakpoint on the toolbar or press F9.
- 3 Click Go on the toolbar or press F5.
The Script Editor runs your script at full speed from the beginning and then pauses prior to executing the line containing the breakpoint. It places the instruction pointer on that line to designate it as the line that will be executed next. You can now resume stepping through your script from that point.
Debugging Selected Portions of Your Script
You can use breakpoints if you only need to debug parts of your script.
To debug selected portions of your script by using breakpoints:
- 1 Place a breakpoint at the start of each portion of your script that you want to debug.
Note: Up to 255 lines in your script can contain breakpoints.
- 2 Click Go on the toolbar or press F5.
The script executes at full speed until it reaches the line containing the first breakpoint and then pauses with the instruction pointer on that line.
- 3 Step through as much of the code as you need to.
- 4 To resume running your script, click Go on the toolbar or press F5.
The script executes at full speed until it reaches the line containing the second breakpoint and then pauses with the instruction pointer on that line.
- 5 Repeat steps 3 and 4 until you have finished debugging the selected portions of your script.
Removing a Single Breakpoint Manually
To delete breakpoints manually one at a time:
- 1 Place the insertion point on the line containing the breakpoint that you want to remove.
- 2 Click Toggle Breakpoint on the toolbar or press F9.
Removing All Breakpoints Manually
To delete all breakpoints manually in a single operation, click Debugger > Clear All Breakpoints.
Working with Watch VariablesWatch variables allow you to track the changing values of variables in a script.
Adding Watch Variables
To add a variable to the Script Editor's watch variable list:
- 1 Click Add Watch on the toolbar or press SHIFT+F9.
Figure 13 Add Watch Dialog Box
- 2 In the Variable list, enter the name of the variable you want to add to the watch variable list.
You can only watch variables of fundamental data types, such as Integer, Long, Variant, and so on; you cannot watch complex variables such as structures or arrays. You can, however, watch individual elements of arrays or structure members.
Use the following syntax to watch individual elements of arrays or structure members in a script:
[variable
[(index
,...)] [.member
[(index
,...)]]...]Where
variable
is the name of the structure or array variable,index
is a literal number, andmember
is the name of a structure member.For example, Table 6 shows valid watch expressions.
Note: If you are executing the script, you can display the names of all the variables that are "in scope," or defined within the current function or subroutine, in the Variable drop-down list and select the variable you want from that list.
- 3 In the Procedure box, enter the name of the RoseScript subroutine or function whose variable you want to add to the watch variable list. For example, Main for the Main subroutine, Area for the Area function,
- 4 In the Script box, enter the name of the RoseScript without the .ebs extension whose variable you want to add to the watch variable list. For example, CountClasses for the CountClasses.ebs RoseScript.
- 5 Click OK or press ENTER.
If this is the first variable you are placing on the watch variable list, the watch pane opens far enough to display that variable. If the watch pane was already open, it expands far enough to display the variable you just added.
Note: Although you can add as many watch variables to the list as you want, the watch pane only expands until it fills half of the Script Editor's application window. If your list of watch variables becomes longer than that, you can use the watch pane's scroll bars to bring hidden portions of the list into view.
Selecting Variables on the Watch List
To delete a variable from the Script Editor's watch variable list or modify the value of a variable on the list, do one of the following:
- Place the mouse pointer on the variable you want to select and click the left mouse button.
- If one of the variables on the watch list is already selected, use the arrow keys to move the selection highlight to the desired variable.
- If the insertion point is in the edit pane, press F6 to highlight the most recently selected variable on the watch list and then use the arrow keys to move the selection highlight to the desired variable.
Note: Pressing F6 again returns the insertion point to its previous position in the edit pane.
Deleting Watch Variables
To delete a selected variable from the Script Editor's watch variable list:
- 1 Select the variable on the watch list.
- 2 Click Debugger > Delete Watch, or press DELETE.
Modifying the Value of Variables on the Watch Variable List
When the debugger has control, you can modify the value of any of the variables on the Script Editor's watch variable list.
To change the value of a selected watch variable.
- 1 Do one of the following:
- Place the mouse pointer on the name of the variable whose value you want to modify and double-click the left mouse button.
- Select the name of the variable whose value you want to modify and press ENTER or F2.
Figure 14 Modify Variable Dialog Box
Note: The name of the variable you selected on the watch variable list appears in the Name box.
When you use the Modify Variable dialog box to change the value of a variable, you do not have to specify the context. The Script Editor first searches locally for the definition of that variable, then privately, then publicly.
- 2 In the Value box, enter the new value for your variable.
- 3 Click OK.
Compiling Your ScriptTo create compiled script files from your script source:
- 1 Click Tools > Open Script and select the file that contains the script you want to compile.
- 2 Click Debugger > Compile or press F7.
- 3 Enter the name of the file in which to save the compiled script and select OK.
Note: You can also use the Application.CompileScriptFile method to compile scripts. See the online Help for more details.
Using Interscript CallsGuidelines for Using a Script to Call Another Script
You can write a script that includes code that calls and executes another script. The following guidelines apply to this process:
- You can only call and execute a compiled script from within another script.
- Use the LoadScript method to load the script into memory.
- Use the FreeScript method to unload the script from memory.
- Even if you call LoadScript multiple times, the script is only loaded into memory one time. However, for each LoadScript call you make, you must include a corresponding FreeScript call. If you do not do this, the script will not be unloaded from memory.
Debugging Interscript Calls
To debug a script that uses interscript calls:
- 1 Enter the call to the compiled script you are including and set a breakpoint on the call.
- 2 Click Debugger > StepInto.
Note: The script you are calling must be compiled with debugging turned on. See Compiling Your Script for details.
Working with the Dialog EditorInserting a Dialog Box into Your Script
To insert a dialog box into your script:
- 1 Place the insertion point where you want the BasicScript code for the dialog box to appear in your script.
- 2 Click Edit > Insert Dialog.
The Script Editor's application window is temporarily unavailable, and Dialog Editor appears, displaying a new dialog box in its application window.
- 3 Use the Dialog Editor to create your dialog box.
- 4 Click File > Exit and Return from the Dialog Editor menu to return to the Script Editor.
Editing an Existing Dialog Box
To edit an existing dialog box template in your script:
- 1 Select the BasicScript code for the entire dialog box template.
- 2 Click Edit > Edit Dialog.
Displaying and Adjusting the Grid
The X and Y settings help you position controls more precisely within your dialog box. The values of X and Y in the Grid dialog box determine the grid's spacing. Assigning smaller X and Y values produces a more closely spaced grid, which enables you to move the mouse pointer in smaller horizontal and vertical increments as you position controls. Assigning larger X and Y values produces the opposite effect on both the grid's spacing and the movement of the mouse pointer. The X and Y settings entered in the Grid dialog box remain in effect regardless of whether you choose to display the grid.
To display and adjust the grid:
Figure 15 Grid Dialog Box
- 2 To display the grid in your dialog box, select the Show grid check box.
- 3 Enter new values in the Horizontal (X) and Vertical (Y) boxes.
- 4 Click OK or press ENTER.
Figure 16 Dialog Editor with Grid Displayed
- 5 With the grid displayed, line up the crosshairs on the mouse pointer with the dots on the grid to position controls precisely and align them with other controls.
Changing Titles and Labels
To change the title of a dialog box, as well as the labels of group boxes, option buttons, push buttons, text controls, and check boxes:
- 1 Display the Information dialog box for the dialog box whose title you want to change or for the control whose label you want to change.
- 2 Enter the new title or label in the Text$ box.
Note: Dialog box titles and control labels are optional. Therefore, you can leave the Text$ box blank.
- 3 If the information in the Text$ box should be interpreted as a variable name rather than a literal string, select the Variable Name check box.
- 4 Click OK or press ENTER.
Assigning Accelerator Keys
To designate a letter from a control's label to serve as the accelerator key for that control.
- 1 Display the Information dialog box for the control to which you want to assign an accelerator key.
- 2 In the Text$ box, type an ampersand (&) before the letter you want to designate as the accelerator key.
- 3 Click OK or press ENTER.
Capturing Standard Windows Dialog Boxes
To capture the standard Windows controls from any standard Windows dialog box in another application, and insert those controls into the Dialog Editor for editing:
- 1 Display the dialog box you want to capture.
- 2 Open the Dialog Editor.
- 3 Click File > Capture Dialog.
Figure 17 Capturing a Dialog Box
- 4 Select the dialog box that you want to capture, then click OK.
Note: The Dialog Editor only supports standard Windows controls and standard Windows dialog boxes. Therefore, if the target dialog box contains both standard Windows controls and custom controls, only the standard Windows controls will appear in the Dialog Editor's application window. If the target dialog box is not a standard Windows dialog box, you will be unable to capture the dialog box or any of its controls.
Testing Your Dialog Boxes
The Dialog Editor lets you run your edited dialog box for testing purposes. When you click Test Dialog, your dialog box becomes functional, which gives you an opportunity to make sure it functions properly and fix any problems before you incorporate the dialog box template into your script.
Before you run your dialog box, take a moment to look it over for basic problems such as the following:
- Does the dialog box contain a command button--that is, a default OK or Cancel button, a push button, or a picture button?
- Does the dialog box contain all the necessary push buttons?
- Does the dialog box contain a Help button if one is needed?
- Are the controls aligned and sized properly?
- If there is a text control, is its font set properly?
- Are the close box and title bar displayed (or hidden) as you intended?
- Are the control labels and dialog box title spelled and capitalized correctly?
- Do all the controls fit within the borders of the dialog box?
- Could you improve the design of the dialog box by adding one or more group boxes to set off groups of related controls?
- Could you clarify the purpose of any unlabeled control (such as a text box, list box, combo box, drop-down list, picture, or picture button) by adding a text control to serve as a label for it?
- Have you made all the necessary accelerator key assignments?
- After you have fixed any elementary problems, you are ready to run your dialog box so you can check for problems that do not become apparent until a dialog box is activated.
Testing your dialog box is an iterative process that involves running the dialog box to see how well it works, identifying problems, stopping the test, and fixing those problems. You can then run the dialog box again to make sure the problems are fixed and to identify any additional problems, and do so until the dialog box functions the way you intend.
To test your dialog box and fine-tune its performance:
- 1 Click Test Dialog on the toolbar, or press F5, to make the dialog box operational.
- 2 Check the dialog box's functions.
- 3 To stop the test, click Test Dialog, press F5, or click the dialog box's close box (if it has one).
- 4 Make any necessary adjustments to the dialog box.
- 5 Repeat steps 1-4 as many times as you need in order to get the dialog box working properly.
Incorporating Dialog Boxes or Controls into Your Script
You create dialog boxes and dialog box controls in the Dialog Editor. To incorporate them into a script, you copy them to the Clipboard. When you copy the dialog box to the Clipboard, it is stored in the form of Basic Script statements. You then paste the contents of the Clipboard into the script.
To incorporate a dialog box or control into your script:
- 1 Select the dialog box or control that you want to incorporate into your script.
- 2 Press CTRL+C.
- 3 Open your script and paste the contents of the Clipboard at the desired point.
The dialog box template or control appears in BasicScript statements in your script, as shown in Figure 18.
Figure 18 Sample Dialog Box in Basic Script
Selecting Controls
To select a control in a dialog box, do one of the following:
- With the Pick tool active, place the mouse pointer on the desired control and click the mouse button.
- With the Pick tool active, press the TAB key repeatedly until the focus moves to the desired control.
Selecting Dialog Boxes
To select an entire dialog box, do one of the following:
- With the Pick tool active, place the mouse pointer on the title bar of the dialog box or on an empty area within the borders of the dialog box (that is, on an area where there are no controls) and click the mouse button.
- With the Pick tool active, press the TAB key repeatedly until the focus moves to the dialog box.
Repositioning Items
Repositioning Items with the Mouse
The increments by which you can move a control with the mouse are governed by the grid setting. For example, if the grid's X setting is 4 and its Y setting is 6, you will be able to move the control horizontally only in increments of 4 X units and vertically only in increments of 6 Y units. This feature is useful if you are trying to align controls in your dialog box. See Displaying and Adjusting the Grid.
To reposition an item in a dialog box or control by dragging it with the mouse:
- 1 With the Pick tool active, place the mouse pointer on an empty area of the dialog box or on a control.
- 2 Press the mouse button and drag the dialog box or control to the desired location.
Repositioning Items with the Arrow Keys
To reposition an item in a dialog box or control by dragging it with the arrow keys:
- 1 Select the dialog box or control that you want to move.
- 2 Do one of the following:
- Press an arrow key once to move the item by one X or Y unit in the desired direction.
- Repeatedly press an arrow key to "nudge" the item gradually along in the desired direction.
Note: When you reposition an item with the arrow keys, a faint, partial afterimage of the item may remain visible in the item's original position. These afterimages disappear once you test your dialog box.
Repositioning Dialog Boxes with the Dialog Information Dialog Box
To reposition items in a dialog box or control by using the Dialog Information dialog box:
- 1 Display the Dialog Box Information dialog box.
Note: For information on displaying the Dialog Information dialog box, see Displaying the Information Dialog Boxes for Dialog Boxes.
- 2 Do one of the following:
- Change the X and Y coordinates in the Position group box.
- Leave the X and/or Y coordinates blank.
- 3 Click OK or press ENTER.
If you specified X and Y coordinates, the dialog box moves to that position. If you left the X coordinate blank, the dialog box will be centered horizontally relative to the parent window of the dialog box when the dialog box is run. If you left the Y coordinate blank, the dialog box will be centered vertically relative to the parent window of the dialog box when the dialog box is run.
Repositioning Controls with the Dialog Information Dialog Box
To move a selected control by changing its coordinates in the Dialog Information dialog box for that control:
Note: For information on displaying the Dialog Information dialog box, see Displaying the Information Dialog Boxes for Controls.
- 1 Display the Information dialog box for the control that you want to move.
- 2 Change the X and Y coordinates in the Position group box.
- 3 Click OK or press ENTER.
Resizing Items
Resizing Items with the Mouse
To change the size of a selected dialog box or control by dragging its borders or corners with the mouse:
- 1 With the Pick tool active, select the dialog box or control that you want to resize.
- 2 Place the mouse pointer over a border or corner of the item.
- 3 Depress the mouse button and drag the border or corner until the item reaches the desired size.
Resizing Items with the Information Dialog Box
To change the size of a selected dialog box or control by changing its Width or Height settings in the Information dialog box:
- 1 Display the Information dialog box for the dialog box or control that you want to resize.
- 2 Change the Width and Height settings in the Size group box.
- 3 Click OK or press ENTER.
Resizing Selected Items Automatically
To adjust the borders of certain controls automatically to fit the text displayed on them:
- 1 With the Pick tool active, select the option button, text control, push button, check box, or text box that you want to resize.
- 2 Press F2.
Adding Controls
To add one or more controls to your dialog box using simple mouse and keyboard methods.
- 1 From the toolbar, choose the tool corresponding to the type of control you want to add.
Note: When you pass the mouse pointer over an area of the display where a control can be placed, the pointer becomes an image of the selected control with crosshairs (for positioning purposes) to its upper left. The name and position of the selected control appear on the status bar. When you pass the pointer over an area of the display where a control cannot be placed, the pointer changes into a circle with a slash through it (the "prohibited" symbol).
Note: You can only insert a control within the borders of the dialog box you are creating. You cannot insert a control on the dialog box's title bar or outside its borders.
- 2 Place the pointer where you want the control to be positioned and click the mouse button.
The control you just created appears at the specified location. The upper left corner of the control corresponds to the position of the pointer's crosshairs at the moment you clicked the mouse button. The control is surrounded by a thick frame, which means that it is selected, and it may also have a default label.
After the new control appears, the mouse pointer becomes an arrow, to indicate that the Pick tool is active and you can once again select any of the controls in your dialog box.
- 3 To add another control of the same type as the one you just added, press CTRL+D.
- 4 To add a different type of control, repeat steps 1 and 2.
- 5 To reactivate the Pick tool, do one of the following:
- Click the arrow-shaped tool on the toolbar.
- Click the title bar of the dialog box or outside the borders of the dialog box (that is, on any area where the mouse pointer turns into the "prohibited" symbol).
Duplicating Controls
You can use the Dialog Editor's duplicating feature to create one or more copies of a particular control.
- 1 Select the control that you want to duplicate.
- 2 Press CTRL+D.
- 3 Repeat step 2 as many times as necessary to create the desired number of duplicate controls.
Adding Pictures to a Dialog Box
You can add pictures to a dialog box from a file or from a picture library.
Adding Pictures from Files
You can display a Windows bitmap or metafile from a file on a picture control or picture button control by using the control's Information dialog box to indicate the file in which the picture is contained.
- 1 Display the Information dialog box for the picture control or picture button control whose picture you want to specify.
- 2 In the Picture source option button group, click File.
- 3 In the Name$ box, enter the name of the file containing the picture you want to display in the picture control or picture button control.
Note: By clicking the Browse button, you can display the Select a Picture File dialog box and use it to find the file.
- 4 Click OK or press ENTER.
Adding Pictures from Picture Libraries
You can display a Windows bitmap or metafile from a file on a picture control or picture button control by using the control's Information dialog box to indicate the file in which the picture is contained.
To add pictures from picture libraries:
- 1 Display the Information dialog box for the picture control or picture button control whose picture you want to specify.
- 2 In the Picture source option button group, click File.
- 3 In the Name$ box, enter the name of the file containing the picture you want to display in the picture control or picture button control.
Note: By clicking the Browse button, you can display the Select a Picture File dialog box and use it to find the file.
- 4 Click OK or press ENTER.
Pasting Items into Dialog Editor
Pasting Existing Dialog Boxes into the Dialog Editor
You can modify a BasicScript dialog box template contained in your script by selecting the template and pasting it into the Dialog Editor for editing.
To paste dialog boxes into the Dialog Editor:
- 1 Copy the entire BasicScript dialog box template (from the Begin Dialog instruction to the End Dialog instruction) from your script to the Clipboard.
- 2 Open the Dialog Editor.
- 3 Press CTRL+V.
- 4 When the Dialog Editor asks whether you want to replace the existing dialog box, click Yes.
Pasting Controls from Existing Dialog Boxes into the Dialog Editor
You can modify the BasicScript statements in your script that correspond to one or more dialog box controls by selecting the statements and pasting them into Dialog Editor for editing.
To paste controls into the Dialog Editor:
- 1 Copy the BasicScript description of the control(s) from your script to the Clipboard.
- 2 Open the Dialog Editor.
- 3 Press CTRL+V.
Displaying the Information Dialog Boxes
There are two types of Information dialog boxes:
- Information Dialog Box for Dialogs
- Information Dialog Box for Controls
Displaying the Information Dialog Boxes for Dialog Boxes
To display the Dialog Box Information dialog box to check and adjust attributes that pertain to the dialog box as a whole, do one of the following:
- With the Pick tool active, place the mouse pointer on an area of the dialog box where there are no controls and double-click the mouse button.
- With the Pick tool active, select the dialog box and either click the Information tool on the toolbar, press ENTER, or press CTRL+I.
Figure 19 Dialog Box Information Dialog Box
Attributes You Can Adjust with the Dialog Box Information Dialog Box
The Dialog Box Information dialog box can be used to check and adjust the following attributes, which pertain to the dialog box as a whole:
- Position (optional): X and Y coordinates on the display, in dialog box units
- Size (mandatory): width and height of the dialog box, in dialog box units
- Style (optional): options that allow you to determine whether the close box and title bar are displayed
- Text$ (optional): text displayed on the title bar of the dialog box
- Name (mandatory): name by which you refer to this dialog box template in your BasicScript code
- Function (optional): name of a BasicScript function in your dialog box
- Picture Library (optional): picture library from which one or more pictures in the dialog box are obtained
Displaying the Information Dialog Boxes for Controls
To display the Information dialog box for a control to check and adjust attributes that pertain to that particular control, do one of the following:
- With the Pick tool active, place the mouse pointer on the desired control and double-click the mouse button.
- With the Pick tool active, select the control and either click the Information tool on the toolbar, press ENTER, or press CTRL+I.
The Dialog Editor displays an Information dialog box corresponding to the control you selected. For an example, see Figure 20.
Figure 20 Control Information Dialog Box
Attributes You Can Adjust with the Information Dialog Boxes for Controls
Control Information dialog boxes can be used to check and adjust the attributes of the following controls:
- Default OK Button Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- .Identifier (optional): name by which you refer to a control in your BasicScript code
- Default Cancel Button Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- .Identifier (optional): name by which you refer to a control in your BasicScript code
- Help Button Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- FileName$ (optional): Name of the Help file that you want to invoke
- Context& (mandatory): The context ID specifying which Help topic to jump to
- .Identifier (optional): name by which you refer to a control in your BasicScript code
- Push Button Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- Text$ (optional): text displayed on a control
- .Identifier (optional): name by which you refer to a control in your BasicScript code
- Option Button Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- Text$ (optional): text displayed on a control
- .Identifier (optional): name by which you refer to a control in your BasicScript code
- .Option Group (mandatory): name by which you refer to a group of option buttons in your BasicScript code
- Check Box Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- Text$ (optional): text displayed on a control
- .Identifier (mandatory): name by which you refer to a control in your BasicScript code; also contains the result of the control after the dialog box has been processed
- Group Box Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- Text$ (optional): text displayed on a control
- .Identifier (optional): name by which you refer to a control in your BasicScript code
- Text Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- Text$ (optional): text displayed on a control
- Font (optional): font in which text is displayed
- .Identifier (optional): name by which you refer to a control in your BasicScript code
- Text Box Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- Multiline (optional): option that allows you to determine whether users can enter a single line of text or multiple lines
- .Identifier (mandatory): name by which you refer to a control in your BasicScript code; also contains the result of the control after the dialog box has been processed
- List Box Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- .Identifier (mandatory): name by which you refer to a control in your BasicScript code; also contains the result of the control after the dialog box has been processed
- Array$ (mandatory): name of an array variable in your BasicScript code
- Combo Box Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- .Identifier (mandatory): name by which you refer to a control in your BasicScript code; also contains the result of the control after the dialog box has been processed
- Array$ (mandatory): name of an array variable in your BasicScript code
- Drop List Box Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- .Identifier (mandatory): name by which you refer to a control in your BasicScript code; also contains the result of the control after the dialog box has been processed
- Array$ (mandatory): name of an array variable in your BasicScript code
- Picture Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- .Identifier (optional): name by which you refer to a control in your BasicScript code
- .Identifier (optional): name of the file containing a picture that you want to display or the name of a picture that you want to display from a specified picture library
- Frame (optional): option that allows you to display a 3-D frame
- Picture Button Information dialog box
- Position (mandatory): X and Y coordinates within the dialog box, in dialog box units
- Size (mandatory): width and height of the control, in dialog box units
- .Identifier (optional): name by which you refer to a control in your BasicScript code
- .Identifier (optional): name of the file containing a picture that you want to display or the name of a picture that you want to display from a specified picture library
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |