Skip to content

ShowYesNo - cBaseLocalControlHost

Displays an information dialog with Yes and No buttons

Type: Procedure

Parameters

Parameter Type Description
hoCallBack Handle Handle of callback object
hmCallback Handle Handle of callback message
sMessage String Message to be displayed
sOptCaption String (Optional) Message title
eOptDfltBtn Integer (Optional) The button that should act as the default button (when Enter is pressed on the keyboard)

Syntax

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

Call Example

Send ShowYesNo hoCallBack hmCallback sMessage sOptCaption eOptDfltBtn

Description

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 eOptDfltBtn parameter are:

Constant Meaning
cmClose Dialog was closed
cmYes Dialog Yes button was clicked
cmNo Dialog No button was clicked
cmCancel Dialog 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())
        End
    End_Procedure

    // 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" 
    End_Procedure

End_Object

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
End_Procedure

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

See Also

NavigateNewWindow | NavigateToPage | NavigateRefresh