Release 10.1A: OpenEdge Development:
Progress Dynamics Basic Development

> ## Creating items

> In this section you will define the following different items for your example toolbar:

> - A set of Cut/Copy/Paste items, which will be viewed both as menu items and as toolbar buttons.

> - A Label menu item to group Cut/Copy/Paste when they appear on the menu.

> - Another Label menu item to provide access to the built-in Navigation band.

> - A Label menu item that will be used as a placeholder for another band to be merged into the toolbar at run time.

> - An Action menu item to launch the Administration menu.

> The Cut/Copy/Paste actions will run a procedure that you will write in a custom super procedure supporting the toolbar.

> Figure 12–7 shows a sneak preview of what the final toolbar will look like, placed into a Customer maintenance window.

> Figure 12–7: Example toolbar

> ##### File menu

> The File menu, shown in Figure 12–8, is a standard predefined Progress Dynamics File menu that you will add to your toolbar.

> Figure 12–8: File menu

> The update-related items in this menu (Add, Copy, Delete, Modify, View, Save, Reset, Cancel) will also be buttons. Menu items and toolbar buttons are always enabled and disabled together, as appropriate for the current state of the maintenance operation, and as defined by the Rules for each item. In this case, for example, no changes have been made to the current record (so the `DataModified` property is `FALSE`). As a result, the Save, Reset, and Cancel items, both as menu items and as toolbar buttons, are disabled.

> ##### Edit menu

> The Edit menu item, shown in Figure 12–9, contains three other items that define Cut, Copy, and Paste operations.

> Figure 12–9: Edit menu

> ##### Search menu

> These same three operations are also available as buttons on the toolbar. The Search menu item, shown in Figure 12–10, will be a new label to which you will attach a standard Progress Dynamics Navigation band.

> Figure 12–10: Search menu

> These items will also be seen as Navigation buttons on the toolbar.

> ##### Modules menu

> The Modules item, shown in Figure 12–11, is a label under which you will place an Action item to launch the Administration window, as shown in Figure 12–12.

> Figure 12–11: Modules menu

> Figure 12–12: Progress Dynamics Administration window

> ##### Help menu

> Finally, the Help menu item brings in the standard Progress Dynamics Help menu.

> | To create the set of items described above:

> 1. Right-click on your new Tutorial Category and select Add Item, as shown:

> Do the following:

> 1. Create the Label item for the Edit function, which will group together the cut, copy, and paste operations that you define next.
> 2. Enter tEdit for the Item Reference, Edit Label for the Description, &Edit for the Menu Label.
> 3. Select Label as the Item Type.
> 4. Enter a Narration such as Edit label for use with cut/copy/paste operations. Because this item is just a label, the Action list is disabled, because no action is associated with a label.
> 5. Choose Save to save this first item.
> 2. Choose Add in the Item Maintenance tab to create the next new item and do the following:

> 1. Enter tCut as the Item Reference, Cu&t as the Menu Label, Cut as the Description, and Action as the Item type.
> 2. To define a short-cut key for the item, choose the Key button to display the Record Menu Accelerator dialog box, as shown:

> 3. Press the control sequence CTRL+X, then choose OK to save this sequence.
> 4. Enter the Cuts the current select and puts it on the clipboard for Narration . Because you chose an Item Type of Action, the Action Type list is enabled.
> 5. Select RUN from this list.
> 6. Enter EditAction as the Action. This is the name of an internal procedure that you will write a little later to perform the Cut operation.
> 7. Enter Cut as the parameter. This value will be passed as a `CHARACTER` literal to the `EditAction` procedure, so that it will know what kind of action to perform.

> This next item is the first of three action items that will run a procedure to perform `cut`, `copy`, and `paste` operations in the window where the toolbar is placed.

> 3. To make the `cut`, `copy`, and `paste` operations become toolbar buttons, as well as menu items, follow these steps to define those attributes of the item next:

> 1. In the Toolbar section of the Item tab, the value Cut should be set for you as the default for the Label. Since you will be displaying the Item in the toolbar using an image, the label does not matter, so leave this as the default value.
> 2. Choose the Image 1 button to display the following dialog box:

> 3. Select ry/img as the Directory, and then locate the `objectcut.bmp` image file in that directory.
> 4. Choose OK to select it.
> 5. (Optional) Alternatively, you could click the drop-down arrow next to the Image1 label and select PicClip1. If an image is the importation of a graphic file, a PicClip is the importation of a cropped piece of a graphic file. You could keep all of your icons in one compact file and use this feature to clip the appropriate icon out of the file. When you select a PicClip image, you must also enter the offsets in the following format:

>     image, x-offset, y-offset, width, height

> 6. Choose Save to record your definition of the Cut Item. All of your data should look like this:

> In this case, only the Cut and Edit items will be displayed as a node in the Tutorial category in the TreeView. The rest of the items you will create next.

> 4. Create two more items just like the Cut item by following these steps:

> 1. Choose Add to create the first item.
> 2. Give it the Item Reference, tCopy.
> 3. Define its shortcut key to be CTRL+C.
> 4. Pass `Copy` as the parameter for the `EditAction` procedure.
> 5. Choose the `afcopy.bmp` image file to represent it in the toolbar. All the other choices should be the same as for the Cut item.
> 6. Choose Add to create the second of the two remaining edit items, the Paste item.
> 7. Give this an Item Reference name tPaste.
> 8. Define its shortcut key to be CTRL+V.
> 9. Pass `Paste` as the parameter for the `EditAction` procedure.
> 10. Choose the`afpaste.bmp` image file to represent it in the toolbar.
> 5. Create a label for a menu item to which you can add other related application modules, so that the user can invoke these from the window that contains your new toolbar:

> 1. Add another new Item.
> 2. Give it the Item Reference, tModule, a menu label of &Modules, and a Description of Module Label.
> 3. Select the Item Type, Label, and give it an appropriate narration as a description.
> 4. Choose Save to complete the Modules item.
> 6. The next item you create (using the following steps) will launch a dynamic container object when selected, the Progress Dynamics Administration menu controller window:

> 1. Choose Add to create another item.
> 2. Give it an Item Reference of tAdmin, a menu label of &Admin, and a Description of Progress Dynamics Administration.
> 3. Select an Item Type of Action.
> 4. Select Launch as the Action Type. This changes the field below the Action Type to be Object Filename.
> 5. Enter the name of the Administration control window, afallmencw.
> Note: Note the difference between choosing an Action Type of `RUN`, which will run an actual 4GL procedure, and `LAUNCH`, which will make the framework read the Repository records for a logical object that has no procedure, and instantiate it as a dynamic object.

> 6. Save the Admin item.
> 7. Choose Add to create one final item. This will be another label item used to provide access to a Navigation band of items already defined for you in the framework.
> 8. Give the new item an Item Reference of tSearch, a menu label of &Search, a Description of Search Label, and an Item Type of Label.
> 9. Choose Save to complete the definition of this final item.

> After the discussion of bands in the next section, you will define bands where you will group these items together.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095