ShowMessageBox - cWebApp

Displays a web message box

Type: Procedure

Parameters: Handle hoObj Handle hoReturnMsg String sMessage String sOptCaption String sOptLabelCSSClass Integer eOptDefaultButton String[] asOptButtons

ParameterDescription
hoObjHandle of callback object
hoReturnMsgHandle of callback message
sMessageMessage to be shown
sOptCaption(Optional) Message caption
sOptLabelCSSClass(Optional) CSS class for label
eOptDefaultButton(Optional) The button that should act as the default button (when Enter is pressed on the keyboard)
asOptButtons(Optional) String array containing text for optional buttons


Syntax
Procedure ShowMessageBox Handle hoObj Handle hoReturnMsg String sMessage String sOptCaption String sOptLabelCSSClass Integer eOptDefaultButton String[] asOptButtons

Call: Send ShowMessageBox hoObj hoReturnMsg sMessage sOptCaption sOptLabelCSSClass eOptDefaultButton asOptButtons


Description

ShowMessageBox can display a great variety of custom web message boxes.

The ShowYesNo message is used to handle yes/no confirmations and uses the lower level ShowMessageBox. The ShowInfoBox message can be used to display a simpler message and title caption.


Using Callbacks


ShowYesNo, ShowYesNoCancel and ShowMessageBox use the concept of a callback object and message. These are passed to the procedure and passed to the client. Upon completion the client makes a server call, which will send a callback message to the callback object passing the results of the confirmation. Therefore, a confirmation must consist of code for creating the confirmation and a method handler to handle the response.

When callbacks are used, the callback must be an allowable callback for the callback object. This is accomplished by publishing the method, which is what the WebPublishProcedure command does here. This is done to make sure that only known methods are processed on the server.


Confirmation Messages


Note that this confirmation is already built into the data entry framework and save, delete and data-loss confirmations are be made setting the Verify_Save_Msg, Verify_Delete_Msg and Verify_Data_Loss_Msg to an appropriate confirmation method. By default, they are enabled and they call the built in SaveConfirmation, DeleteConfirmation and DataLossConfirmation methods.

Sample

If I wanted to make a ShowYupNopeNevermind method, you would write this:

Procedure ShowYupNopeNevermind Handle hoCallBack Handle hmCallback String sMessage String sTitle Integer eDfltBtn
    String sCSSClass
    String[] ButtonTextArray
    Integer eDflt
    
    Move "Yup" to ButtonTextArray[0]
    Move "Nope" to ButtonTextArray[1]
    Move "Nevermind"  to ButtonTextArray[2]
    
    If (Num_Arguments < 5) Begin
        Move 3 to eDflt
    End
    Else Begin
        Move eDfltBtn to eDflt
    End
    
    Move "WebMsgBoxConfirm" to sCSSClass // assume this defines any images and other features for a yes/no dialog.    
    
    Send ShowMessageBox hoCallBack hmCallback sMessage sTitle sCSSClass eDflt ButtonTextArray
End_Procedure


To insert a line break, insert "\n\r" into your text.

Procedure CustomResponse Integer eBtn
    // do something
End_Procedure

Procedure OnClick
    String sMessage

    Move "This is the first line of text.\n\rThis is the second line of text." to sMessage

    Send ShowMessageBox of oWebApp Self (RefProc(CustomResponse)) sMessage
End_Procedure

See Also

NavigateNewWindow | NavigateToPage | NavigateRefresh