// This code is part of VDF GUIdance // Visit us @ http://www.vdf-guidance.com // e-Mail us @ info@vdf-guidance.com // VDF GUIdance is a mutual project of // Frank Vandervelpen - Vandervelpen Systems and // Wil van Antwerpen - Antwise Solutions // All software source code should be used AS IS without any warranty. // Author: Wil van Antwerpen // // (c) 1999, Antwise Solutions // // Microsob tells us to use an exclamationmark as icon for a warning-box instead of a // questionmark, wich is the dataflex default icon in a standard YNC box. // The only change from a normal YesNoCancel_Box in this case is the icon. Function YesNoCancel_WarningBox GLOBAL String sMessage String sTitle Integer DfltBtn ; Returns Integer Handle hWnd String sCaption Integer rval Integer Dflt If (Num_Arguments = 1 Or sTitle = '') Move 'Question' To sCaption Else Move sTitle To sCaption If (Num_Arguments < 3 Or DfltBtn = 0 Or DfltBtn = MB_DEFBUTTON1); Move MB_DEFBUTTON1 To Dflt Else If (DfltBtn = 1 Or DfltBtn = MB_DEFBUTTON2); Move MB_DEFBUTTON2 To Dflt Else ; Move MB_DEFBUTTON3 To Dflt Get Message_Box sMessage sCaption MB_YESNOCANCEL (MB_ICONEXCLAMATION Ior Dflt) ; To rval Function_Return rval End_Function // YesNoCancel_WarningBox // Override of the verify_exit_application to see if view is changed. If changed, // display exit message as required // Yes-No-Cancel introduced #IF PKG_Version<|CI9 Function Verify_Exit_Application For AppDialog Returns Integer #ELSE Function Verify_Exit_Application For MdiDialog Returns Integer #ENDIF Integer bStop_Exit Integer bView_Changed Integer bShould_Save Integer iUsers_Choice Integer iGet_Save_Confirmation String sMessageText Get View_Changed To bView_Changed // Ask for changes in Data-sets If bView_Changed Begin Move "Do you want to save the changes you made in '" To sMessageText Append sMessageText (label(Self)) Append sMessageText "',\n" Append sMessageText "before you exit the application?" Get YesNoCancel_WarningBox sMessageText "Confirm" MB_DefButton1 To iUsers_Choice Case Begin Case (iUsers_Choice Eq MBR_Yes) // default choice // turn off save confirmation, if it's on that is... Get Verify_Save_Msg To iGet_Save_Confirmation Set Verify_Save_Msg To Get_No_Confirmation // Perform the save Send Request_Save Get Should_Save To bShould_Save If bShould_Save Begin // Something went wrong during saving, cancel the exit.... Move 1 To bStop_Exit End // restore the save confirmation... Set Verify_Save_Msg To iGet_Save_Confirmation Case Break Case (iUsers_Choice Eq MBR_No) // Exit the program, return a iretval with it's initialized value == False Case Break Case (iUsers_Choice Eq MBR_Cancel) Move 1 To bStop_Exit // Cancel the Exit ... Case Break Case End End Function_Return bStop_Exit End_Function // Verify_Exit_Application // The dataflex standard is to tell the user that changes exist and ask the question // if he wants to lose these changes. and the choices: [no] // This is very confusing for users because this is not standard windows behaviour. // The windows default is to tell a user that there are changes and he will get a question // if he wants to save these with the choices: [no] [cancel] // The result of just pressing the enter-key is completely the opposite. // notation remark: [other] // Behaviour is changed to the windows standard. // This function is invoked by the verify_exit_msg function. . . // Note: // Using the For Desktop option will replace the default function with this one. // 2003-07-29 ------------------------------------ Start Nils G. Svedmyr #IF PKG_Version<|CI9 Function Exit_Loss_Confirmation For Desktop Returns Integer #ELSE Function xExit_Loss_Confirmation For View Returns Integer #ENDIF // 2003-07-29 ------------------------------------ Stop Nils G. Svedmyr Integer bStop_Exit Integer bShould_Save Integer iUsers_Choice Integer iGet_Save_Confirmation String sMessageText Get Should_Save To bShould_Save If bShould_Save Begin Move "Do you want to save the changes you made in '" To sMessageText Append sMessageText (label(Self)) Append sMessageText "'?" Get YesNoCancel_WarningBox sMessageText "Confirm" MB_DefButton1 To iUsers_Choice Case Begin Case (iUsers_Choice Eq MBR_Yes) // default // turn off save confirmation, if it's on that is... Get Verify_Save_Msg To iGet_Save_Confirmation Set Verify_Save_Msg To Get_No_Confirmation // Perform the save Send Request_Save Get Should_Save To bShould_Save If bShould_Save Begin // Something went wrong during saving, cancel the exit.... Move 1 To bStop_Exit End // restore the save confirmation... Set Verify_Save_Msg To iGet_Save_Confirmation Case Break Case (iUsers_Choice Eq MBR_No) // Exit the view, return a iretval with it's initialized value == False Case Break Case (iUsers_Choice Eq MBR_Cancel) Move 1 To bStop_Exit // Cancel the Exit ... Case Break Case End End Function_Return bStop_Exit End_Function // Exit_Loss_Confirmation