Parameter | Description |
---|---|
hoCallBack | Handle of callback object |
hmCallback | Handle of callback message |
sMessage | Message 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.
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:
Constant | Meaning |
---|---|
cmClose | Dialog was closed |
cmYes | Dialog Yes button was clicked |
cmNo | Dialog No button was clicked |
cmCancel | Dialog was cancelled |
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.
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_ProcedureSee Also