Building Form Messages

When you want to display a message on a form in your application, the first step is to use the VPME Message Builder to build the form message that you want to display.

Ø To build a form message

1.   Message Builder: Select Message Builder on the VPME Tools menu. VPME Displays the Message Builder.

2.   New: Click the New button on the Form Toolbar to create a new blank message record.

3.   Message ID: Enter an ID that will uniquely identify your form message. You can enter up to 50 characters.

ID Tip 1: We use the beginning characters of the message itself as the message ID for the application messages that VPME provides. The first 50 characters of a message normally will uniquely identify the message. Also, since the message records are displayed in alphabetical order by the message ID, using the beginning characters of messages for the ID’s makes it easier to find a specific message.

ID Tip 2: If your message is 50 or fewer characters, you only need to enter the message in the message ID text box. You do not need to reenter the message in the Message edit box. If the Message edit box is left blank, your entry in the ID text box will be displayed as the message.

4.   Message: Enter the message text in the Message edit box.

5.   Message Expression: Instead of entering message text in the Message edit box, you can enter an expression and check the Message Expression check box. When the Message Expression check box is checked, the message text displayed on the form is determined by evaluating the expression in the Message edit box.

6.   Comments: Enter comments about the message in the Comments edit box.

Comment Tip: We enter the name of the program, form or class that calls the message in the Comments edit box. We suggest you do the same for your messages.

7.   Form Options: Click the Form Options page on the Message Builder.

8.   Caption: Enter the form caption that you want to display on the message form. If you leave the Caption text box empty, your application’s Name and Version will be displayed as the form caption.

9.   Font: The default font for your form message and the buttons you select for the form is Arial, 9. You can change the message and button font by clicking the Font button and selecting the font you want on the font dialog.

10. Picture: If you wish to display a bitmap picture on the left side of your form message, check the Display Picture check box. Then, click the option button of the picture you want. You can choose the following standard pictures:

·       Exclamation Point

·       Information – i

·       Question Mark

·       Stop Sign

   If you want a custom picture, select the Other option button. Then, click the Other command button to locate your custom bitmap file.

11. Buttons: If you wish to use one of the standard button groups that VPME provides for form messages, select the option button for the button group you want. If you want to create your own button group, go to step 12. VPME provides the following standard button groups:

·       OK

·       OK, Cancel

·       Yes, No

·       Yes, No, Cancel

·       Abort, Retry, Ignore

·       Retry, Cancel

   VPME will place the buttons you select on the message form.

   When a button on a message form is pressed, a numeric value is returned by the DisplayMessage method of the Messaging class. The following table shows the return value for each button.

Button

Value

OK

1

Cancel

2

Abort

3

Retry

4

Ignore

5

Yes

6

No

7

   The return value identifies which button was pressed. You use the return value to determine the action to take when a message form is closed.

Tip: The Default and Cancel button selections are made for you automatically in the Default and Cancel combo boxes at the bottom of the Form Options page when you choose a standard button group. While you would rarely want to do so, you can change the Default and Cancel button selections for a standard button group. See step 12 for a description of the Default and Cancel button selections.

12. Custom Buttons: If you wish to create your own custom buttons for a form message, select the Other option button at the bottom of the list of button groups.  The captions of the buttons you create will be listed in the list box at the right of the standard button groups. To create a custom button, take the following steps:

·       Add: Click the Add button beneath the custom buttons list box.

·       Caption: Enter the button caption in the Caption text box.

·       Return Value: Select the numeric return value for the button in the Return text box.

·       Additional Buttons: To add additional buttons, repeat the previous three steps.

·       Default: In the Default combo box, select the button that should have the focus when the message form is displayed.

·       Cancel: In the Cancel combo box, select the Cancel button for the custom button group. The Cancel button is the button that should be implicitly pressed when the Esc key is pressed or when the close button in the upper right-hand corner of the message form is clicked. If  you choose “None” in the Cancel combo box, the form message will not have a Cancel button, which means that pressing Esc will not close the form and the upper right-hand corner close button will be disabled.

Tip - Caution: If you have created custom buttons and then select the option button of one of the standard button groups before you have saved the form message record you are building, you will lose your custom button definitions. Accordingly, it’s a good idea to periodically save the form message record while you are building custom buttons to make sure you don’t accidentally lose the button definitions you have entered. If you do select one of the standard button groups after entering and saving a custom button group, you can restore the custom button group by clicking the Cancel button on the Form Toolbar.

13. Bell Options: Click the Bell and Wait Options page on the Message Builder.

14. Bell: Click the Sound Bell check box if you want the default bell sound when your message is displayed. If you want a custom sound, also click the WAV button and select your .WAV sound file.

15. Test and Save: After you have made all the entries for your form message, click the Test button under the Message ID on the Message Builder to save the message record and to display the message form. If you need to make any changes to the message, use the Message Builder to make your changes and then test and save again.

 

 

 

More:

Building Status Bar Messages