Step 4 Implement Memo Box Copy Paste Methods Optional

VLF Windows Application Development

Step 4. Implement Memo Box Copy/Paste Methods (Optional)

VFW054 – Edit Text in a Memo / Edit Box

If you examine the Memo box Methods you will find it supports Copy, Paste, Cut, Print and Find.

Copy will copy selected text to the Windows clipboard. The method can be actioned programatically or by the user using the standard shortcut keys, such as Ctrl+C

Note that there are other Methods available such as Replace, which you should investigate later. Once again Feature Help (F2) will provide more information.

In this step you will implement some of these methods using a Pop-Up menu.

1.  In the Design view, select the Memo box, select All Controls on the Controls tab and drag and drop a Pop-up Menu component onto it. The Pop-up menu will be displayed at the top of the Design tab.

     You create can Menu items by typing their Caption, then pressing Enter to create the next menu item.

     The first Pop-up menu component is named PMNU_1, and Menu items are named MITM_1, MITM_2 etc.

     A component, such as the Memo box, will have its Popupmenu property set to the name of the Pop-up menu which was dropped onto it.

     Typing a dash into a menu Caption makes this menu item a divider. Its purpose is to visually separate different parts of the menu.

2.  In this step you will define the Pop-up menu items. If the first menu item (Item1) is not displayed at the top of the Design tab, use the context menu on the Memo box to Edit pop-up menu.

a.  Replace the Item1 text with Copy and press Enter.

b.  Enter Paste and press Enter.

c.  Type a dash (-) character into the next menu item, and press enter

d.  On the new menu item, type Select All and press Enter.

e.  Type dash into the next menu item and press Enter.

f.  Type Find into the new menu item

g.  Save your changes.

Your Pop-up menu should now look like the following:

3.  Create a Click event handling routine for each menu item. To do this, simply position in each menu item and use the Details / Events tab.

     Note that you could have renamed each menu item (for example, MITM_COPY) for example. This is recommended in your own applications. It will make future maintenance much easier.

4.  Complete each menu item Click event so that it invokes the relevant Memo box component method. For example:

Evtroutine Handling(#MITM_1.Click)
#MEMO_1.copy
Endroutine

 

5.  Compile your component.

6.  Execute the Framework as End User and test your Brief Notes command handler and the Pop-Up Menu functions.

     For example you could copy and paste within the same Employee's notes or switch to another employee's Brief Notes to copy into that one.

     Test the Copy, Paste, Select All and Find functionality.