DVMessage

WorkWithPlus provides the possibility to show the messages of the application with different styles by using this User Control. During the execution of the "Design System Wizard" you can define which style will be used for the messages:

Three side-by-side 'Messages Style' panels each show radio button options Modern, Light, Bright, and Use ErrorViewer, with a different option selected in each panel, and sample alert messages ('This is an error/warning/info/success message') rendered in the corresponding color theme (translucent red, pale yellow/blue/green, or solid modern-style colors).

This kind of messages can be used in Transaction in order to replace the default GeneXus messages.

Clear all shown Messages

This UserControl provides the possibility to clear all messages that are being displayed in the form. In order to do this, you need to add the following command:

msg("<#CLEAR#>")

 

Edit Message Style

First, you must import the xpz, located in the following folder: 
 

    <GXDIR>\UserControls\DVelop\DVMessage\DVMessageResources.xpz

 

After that, in the event where you want to trigger the message you must add the following code:

 

msg( DVMessageGetBasicNotificationMsg.Udp(!"NameWindowMessage!", "Message description" ,DVMessageType.MessageType, "", DVMessageBoolean.True,"") )                           

 

Values:

  • DVMessageType.error
   msg( DVMessageGetBasicNotificationMsg.Udp(!"Error!", "Message description" ,DVMessageType.error, "", DVMessageBoolean.True,"") )

                      A red DVelop notification banner displays a warning triangle icon, the title "Error!", and the subtitle "Message description", with a close (X) button at the top-right.

  • DVMessageType.information
   msg( DVMessageGetBasicNotificationMsg.Udp(!"Information", "Message description" ,DVMessageType.information, "", DVMessageBoolean.True,"") )

                      A blue DVelop notification banner displays an information "i" icon, the title "Information", and the subtitle "Message description", with a close (X) button at the top-right.

  • DVMessageType.regular
   msg( DVMessageGetBasicNotificationMsg.Udp(!"Regular", "Message description" ,DVMessageType.regular, "", DVMessageBoolean.True,"") )

                      An orange DVelop notification banner labeled "Regular" shows a warning icon and the subtitle "Message description", with a close (X) button at the top-right, illustrating the default regular notification style.

  • DVMessageType.success
   msg( DVMessageGetBasicNotificationMsg.Udp(!"Success", "Message description" ,DVMessageType.success, "", DVMessageBoolean.True,"") )

                      A green DVelop notification banner displays a checkmark icon, the title "Success", and the subtitle "Message description", with a close (X) button at the top-right.

 

Validation of a field

In a transaction form, we can validate a field by adding a message next to the field:

                      A web form section titled "General Information" shows a read-only "Id" field with value "3" and a required "Name" field, marked with an asterisk, displaying the red validation message "Person Name is required." below its underline.

 But in a Web Panel, we don't have that behavior.

With DVMessage we can add a message error as in a transaction.

So, you must add an event for the field:

Event <fieldName>.IsValid

    if <field>.IsEmpty()
        msg( DVMessageGetBasicNotificationMsg.Udp(!"Error!", "Message description" ,DVMessageType.error,!"#" + <fieldName>.InternalName, DVMessageBoolean.True,"") )
    Endif

EndEvent

For example:

Event Person_PersonName.IsValid

    if PersonName.IsEmpty()
        msg( DVMessageGetBasicNotificationMsg.Udp(!"Error!", "The name is required" ,DVMessageType.error,!"#" + Person_PersonName.InternalName, DVMessageBoolean.True,"") )
    Endif

EndEvent

So we see it at runtime:

                      A web form "Name" input field is shown with a red underline and the validation error text "The name is required" displayed below it.