ShowYesNo - cWebApp

Displays an information dialog with Yes and No buttons

Type: Procedure

Parameters: Handle hoCallBack Handle hmCallback String sMessage String sOptCaption Integer eOptDfltBtn

hoCallBackHandle of callback object
hmCallbackHandle of callback message
sMessageMessage title
sOptCaption(Optional) Message title
eOptDfltBtn(Optional) The button that should act as the default button (when Enter is pressed on the keyboard)

Procedure ShowYesNo Handle hoCallBack Handle hmCallback String sMessage String sOptCaption Integer eOptDfltBtn

Call: Send ShowYesNo hoCallBack hmCallback sMessage sOptCaption eOptDfltBtn


The ShowYesNo message is used to handle yes/no confirmations. It uses the lower level ShowMessageBox, which can also be used to process other types of custom confirmations. 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.

Valid values for the callback message parameter are:

cmCloseDialog was closed
cmYesDialog Yes button was clicked
cmNoDialog No button was clicked
cmCancelDialog was cancelled

This shows an example where a client button click will call OnClick, which then performs a yes/no confirmation. The result of this confirmation results in a call to the ButtonCallback method with the results.

Object oChangeButton is a cWebButton
    Set psCaption to "Click me"

    Procedure ButtonCallback Integer eConfirmMode
        If (eConfirmMode=cmYes) Begin
            WebSet psCaption to (CurrentDateTime())
    // this tells the system that this method is allowed for this object
    WebPublishProcedure ButtonCallback
    Procedure OnClick
        // do confirmation and call this object's ButtonCallback message with the results
        Send ShowYesNo (Self) (RefProc(ButtonCallback)) "Update this" "Question" 

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.

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

Procedure ConfirmResponse Integer eConfirmMode
    // do something

Procedure OnClick
    Send ShowYesNo (Self) (RefProc(ConfirmResponse)) "This is the first line of text.\n\rThis is the second line of text."

See Also

NavigateNewWindow | NavigateToPage | NavigateRefresh