ConfirmCancelMsg Function
Displays a Confirmation (ie Yes/No/Cancel) Message Dialog.

Unit
QESBPCSMsgs

Declaration
Function ConfirmCancelMsg(const Msg: string; var AnsYes: Boolean): Boolean;

Description
If Cancel is pressed then the Result is False, Yes or No give a Result of True, you then check AnsYes to see if the Yes button was pressed. Ensures Default Cursor is displayed, preserves state of cursor.

Parameters
Msg Message to Display.
AnsYes Returns True if Yes is Clicked, False if No is Clicked

Returns
True if Yes or No are Clicked, False if Cancel is Clicked

Category
Routines that produce Dialogs

Implementation

function ConfirmCancelMsg (const Msg: string; var AnsYes: Boolean): Boolean;
var
     Hold: TCursor;
     Ans: Word;
begin
     Hold := Screen.Cursor;
     Screen.Cursor := crDefault;
     try
          Ans := MessageDlg (Msg, mtConfirmation, [mbYes, mbNo, mbCancel], 0);
          Result := Ans <> mrCancel;
          AnsYes := Ans = mrYes;
     finally
          Screen.Cursor := Hold;
     end;
End;


HTML generated by Time2HELP
http://www.time2help.com