// **************************************************************************** // // ** ** // // ** Class : cWizard ** // // ** ** // // ** Purpose : This package defines the following classes: ** // // ** cWizard ** // // ** cWelcomePage ** // // ** cInteriorPage ** // // ** cCompletionPage ** // // ** ** // // ** This package also defines the following private classes: ** // // ** cTextBox cBackButton cNextButton ** // // ** cCancelButton cWizardPage cExteriorPage ** // // ** ** // // ** ** // // ** Author : Emil Stojanov ** // // ** Quantaris ** // // ** ** // // ** Date : 16-10-2000 ** // // ** ** // // ** 06/12/2004 R.Worsley Add a help button ** // // ** 06/16/2004 R.Worsley Reorder the positions of the buttons ** // // ** 06/16/2004 R.Worsley Change vertical size +5 to accomodate XP ** // // ** ** // // **************************************************************************** // Use Windows.Pkg // Standard Windows package Use DfLine.Pkg // LineControl class Use DfBitmap.Pkg // BitmapContainer class Use DfClient.Pkg // dbContainer3d class Use Data_Set.Pkg // To support dataset's Use cdbBasicPanel.pkg Register_Function piCurrentPage Returns Integer Register_Function pbWelcomePage Returns Integer Register_Function pbCompletionPage Returns Integer Register_Function piWelcomePage Returns Integer Register_Function piCompletionPage Returns Integer Register_Procedure CancelWizard Define DS_3DLOOK For |CI$0004 Define DS_MODALFRAME For |CI$80 // Can be combined with WS_CAPTION Define DS_SETFONT For |CI$40 // User specified font for Dlg controls Define WIZARD_FORWARD_NAVIGATE For 2 Define WIZARD_BACKWARD_NAVIGATE For 1 Class cTextBox Is a TextBox Procedure Set Label String sLabel Set Value Item 0 To (Replaces ("\n", sLabel, Character(13))) End_Procedure // Set Label Function Label Returns String Function_Return (Replaces (Character(13), Value (Self, 0), "\n")) End_Function // Label End_Class // cTextBox Class cNextButton Is A Button Procedure Construct_Object Forward Send Construct_Object Set Label To "&Next >" Set Location To 237 245 Set Size To 14 50 Set Default_State To True Set peAnchors To anBottomRight // **WvA End_Procedure // Construct_Object Procedure OnClick If (piCurrentPage (Self) = piCompletionPage (Self)) Begin Send FinishWizard End Else Begin Send SwitchPage WIZARD_FORWARD_NAVIGATE End End_Procedure // OnClick End_Class // cNextButton Class cCancelButton Is A Button Procedure Construct_Object Forward Send Construct_Object Set Label To "Cancel" Set Location To 237 302 Set Size To 14 50 Set peAnchors To anBottomRight // **WvA End_Procedure // Construct_Object Procedure OnClick Send CancelWizard End_Procedure // OnClick End_Class // cCancelButton Class cHelpButton Is A Button Procedure Construct_Object Forward Send Construct_Object Set Label To "F1 - Help" Set Location To 237 15 Set Size To 14 50 Set peAnchors To anBottomRight // **WvA End_Procedure // Construct_Object #IF (FMAC_VERSION < |CI11) Procedure OnClick Send Help End_Procedure // OnClick #ELSE Procedure OnClick String sHelpPath sHelpFile sRegKey sRegValue Integer iRC bOpened Move ("Software\Data Access Worldwide\Visual DataFlex\" + Sysconf (SYSCONF_DATAFLEX_REV)) to sRegKey Move "dbImportHelpDirectory" to sRegValue Get OpenKey of oRegistry sRegKey to bOpened If bOpened Begin If (ValueExists(oRegistry(Self), sRegValue)); Get ReadString of oRegistry sRegValue to sHelpFile Send CloseKey to oRegistry End If (sHelpFile <> "") Send vShellExecute "Open" sHelpFile "" "" // Send Help End_Procedure // OnClick #ENDIF End_Class // cBackButton Class cBackButton Is A Button Procedure Construct_Object Forward Send Construct_Object Set Label To "< &Back" Set Location To 237 195 Set Size To 14 50 Set peAnchors To anBottomRight // **WvA End_Procedure // Construct_Object Procedure OnClick Send SwitchPage WIZARD_BACKWARD_NAVIGATE End_Procedure // OnClick End_Class // cBackButton Class cWizard is a cDbBasicPanel // BasicPanel Procedure Construct_Object Forward Send Construct_Object Property String psHeaderGraphic Property String Private.psLabel Property Integer piCurrentPage -1 Property Integer piWelcomePage -1 Property Integer piCompletionPage -1 Set Minimize_Icon To False Set Maximize_Icon To False Set Modal_State To True Set Size to 260 362 Set piMinSize to 260 362 // Sanity check - RLW // **WvA: commented out in order to use a resizable wizard // **RLW: why? Set Border_Style to Border_Dialog Object oWizardPages Is An Array End_Object // oWizardPages Object oBottomLine Is A LineControl Set GuiSize To 2 1600 Set Location To 228 0 End_Object // oBottomLine Object oNextButton Is A cNextButton End_Object // oNextButton Object oCancelButton Is A cCancelButton End_Object // oCancelButton Object oHelpButton Is A cHelpButton End_Object // oHelpButton Object oBackButton Is A cBackButton End_Object // oBackButton On_Key kCancel Send OnClick To oCancelButton On_Key Key_Alt+Key_N Send OnClick To oNextButton On_Key kClose_Panel Send CancelWizard On_Key kHelp Send OnClick To oHelpButton Set Window_Style To WS_POPUPWINDOW False Set Window_Style To WS_CLIPCHILDREN False Set Window_Style To WS_CAPTION True Set Window_Style To WS_POPUP True Set Window_Style To DS_3DLOOK True Set Window_Style To DS_SETFONT True Set Window_Style To DS_MODALFRAME True Set Extended_Window_Style To WS_EX_DLGMODALFRAME True Set Extended_Window_Style To WS_EX_CONTROLPARENT True End_Procedure // Construct_Object Procedure Set psLabel String sLabel Set private.psLabel To sLabel Set Label To sLabel End_Procedure // Set psLabel // Procedure doHelp // Send Help // End_Procedure Function psLabel Returns String String sLabel Get private.psLabel To sLabel Function_Return sLabel End_Function // psLabel Function NumberOfPages Returns Integer Integer iPageCount Get Item_Count Of oWizardPages To iPageCount Function_Return iPageCount End_Function // NumberOfPages Procedure AddPage Integer hoObject Integer iPageCount Get NumberOfPages To iPageCount If (pbWelcomePage (hoObject)) Begin Set piWelcomePage To iPageCount End If (pbCompletionPage (hoObject)) Begin Set piCompletionPage To iPageCount End Set Value Of oWizardPages Item iPageCount To hoObject End_Procedure // AddPage Procedure Activate_Group Integer iWelComePage Forward Send Activate_group Send Delete_Data To oWizardPages BroadCast Send RegisterPage Get piWelComePage To iWelComePage Send SwitchToPage -1 iWelComePage WIZARD_FORWARD_NAVIGATE End_Procedure // Activate_Group Procedure SwitchToPage Integer iFrom Integer iTo Integer iDirection Integer hoFrom hoTo hoWizardPages Move oWizardPages To hoWizardPages Get Value Of hoWizardPages Item iTo To hoTo If (iFrom <> -1) Begin Get Value Of hoWizardPages Item iFrom To hoFrom Send OnLeaving To hoFrom iTo iDirection Send OnPageChange To hoFrom iFrom iTo iDirection Set Visible_State Of hoFrom To False End Set piCurrentPage To iTo Set Visible_State Of hoTo To True Set Enabled_State Of oBackButton To (Not (pbWelcomePage (hoTo))) If (pbCompletionPage (hoTo)) Begin Set Label Of oNextButton To "Finish" End Else Begin Set Label Of oNextButton To "&Next >" End Send OnEntering To hoTo iFrom iDirection End_Procedure // SwitchToPage Procedure SwitchPage Integer iDirection Integer hoFrom hoTo iFrom iTo hoWizardPages Boolean bOk Move oWizardPages To hoWizardPages Get piCurrentPage To iFrom Get Value Of hoWizardPages Item iFrom To hoFrom If (iDirection = WIZARD_BACKWARD_NAVIGATE) Begin Get piPreviousPage Of hoFrom To iTo End Else Begin Get piNextPage Of hoFrom To iTo End If (iTo >= 0) Begin Get Value Of hoWizardPages Item iTo To hoTo Get ConfirmPageChange Of hoFrom iDirection To bOk If (bOk) Begin Send SwitchToPage iFrom iTo iDirection End End End_Procedure // SwitchPage Procedure FinishWizard Send Close_Panel End_Procedure // FinishWizard Procedure CancelWizard Integer iResult Get YesNo_Box "Are you sure you want to close the wizard?" (psLabel(Self)) To iResult If (iResult = MBR_NO) Begin Procedure_Return End Send Close_Panel End_Procedure // CancelWizard Procedure OnEntering Integer iFrom Integer iDirection End_Procedure // OnEntering Procedure OnPageChange Integer iFrom Integer iTo Integer iDirection End_Procedure // OnPageChange Procedure OnLeaving Integer iTo Integer iDirection End_Procedure // OnLeaving End_Class // cWizard Class cWizardPage Is A dbContainer3d Procedure Construct_Object Forward Send Construct_Object Property Integer pbWelcomePage Public False Property Integer pbCompletionPage Public False Property Integer Private.piPreviousPage Public -1 Property Integer Private.piNextPage Public -1 Set Location To 0 0 Set Size To 228 362 Set Visible_State To False Set Attach_Parent_State To True Set peAnchors To anAll // **WvA End_Procedure // Construct_Object Procedure Set piPreviousPage Integer iPage Set Private.piPreviousPage To iPage End_Procedure // Set piPreviousPage Function piPreviousPage Returns Integer Integer iPreviousPage If (pbWelcomePage (Self)) Begin Move -1 To iPreviousPage End Else Begin If (Private.piPreviousPage (Self) = -1) Begin Move (piCurrentPage (Self) - 1) To iPreviousPage End Else Begin Move (Private.piPreviousPage (Self)) To iPreviousPage End End Function_Return iPreviousPage End_Function // piPreviousPage Procedure Set piNextPage Integer iPage Set Private.piNextPage To iPage End_Procedure // Set piNextpage Function piNextPage Returns Integer Integer iNextPage If (pbCompletionPage (Self)) Begin Move -1 To iNextPage End Else Begin If (Private.piNextPage (Self) = -1) Begin Move (piCurrentPage (Self) + 1) To iNextPage End Else Begin Move (Private.piNextPage (Self)) To iNextPage End End Function_Return iNextPage End_Function // piNextPage Function ConfirmPageChange Integer iDirection Returns Boolean Function_Return True End_Function // ConfirmPageChange Procedure RegisterPage Integer hoSelf hoParent Move Self To hoSelf Move (Parent (hoSelf)) To hoParent Send AddPage To hoParent hoSelf End_Procedure // RegisterPage End_Class // cWizardPage Class cExteriorPage Is A cWizardPage Procedure Construct_Object Forward Send Construct_Object Set Color To clWhite Object oWatermark Is A BitmapContainer Set Location To 0 0 Set Size to 228 109 Set Border_Style to Border_None End_Object // oWatermark Object oHeaderGraphic Is A BitmapContainer Set Location To 11 55 Set Size To 38 41 Set Color To clWhite Set Border_Style To Border_None Set Bitmap_Style To Bitmap_Center Set Bitmap To (psHeaderGraphic (Self)) End_Object // oHeaderGraphic Object oTitle is a cTextbox Set Location To 8 115 Set Size To 24 225 Set Auto_Size_State To False Set Justification_Mode To jMode_Left Set Label To "" Set Color To clWhite Set TypeFace To "VERDANA" Set FontSize To 19 9 End_Object // oTitle Object oDescription is a cTextbox Set Location To 37 115 Set Size to 125 225 Set Auto_Size_State To False Set Justification_Mode To jMode_Left Set Label To "" Set Color To clWhite End_Object // oDescription Object oBottomText is a cTextbox Set Location To 209 115 Set Size To 10 225 Set Auto_Size_State To False Set Justification_Mode To jMode_Left Set Label To "" Set Color To clWhite End_Object // oBottomText End_Procedure // Construct_Object Procedure Set psWatermark String sBitmap Set Bitmap Of oWatermark To sBitmap End_Procedure // Set psWatermark Function psWatermark Returns String String sBitmap Get Bitmap Of oWaterMark To sBitmap Function_Return sBitmap End_Function // psWatermark Procedure Set psTitle String sValue Set Label Of oTitle To sValue End_Procedure // Set psTitle Function psTitle Returns String String sTitle Get Label Of oTitle To sTitle Function_Return sTitle End_Function // psTitle Procedure Set psDescription String sValue Set Label Of oDescription To sValue End_Procedure // Set psDescription Function psDescription Returns String String sDescription Get Label Of oDescription To sDescription Function_Return sDescription End_Function // psDescription Procedure Set psBottomText String sValue Set Label Of oBottomText To sValue End_Procedure // Set psBottomText Function psBottomText Returns String String sBottomText Get Label Of oBottomText To sBottomText Function_Return sBottomText End_Function // psBottomText End_Class // cExteriorPage Class cInteriorPage Is A cWizardPage Procedure Construct_Object Forward Send Construct_Object Object oHeader is a Container3d Set Size to 37 362 Set Color to clWhite Set Border_Style to Border_None Object oTitle is a cTextbox Set Location To 7 14 Set Size To 10 250 Set Auto_Size_State To False Set Justification_Mode To jMode_Left Set Label To "" Set Color To clWhite Set FontWeight To 600 End_Object // oTitle Object oSubTitle is a cTextbox Set Location To 17 28 Set Size to 20 300 Set Auto_Size_State To False Set Justification_Mode To jMode_Left Set Color To clWhite End_Object // oSubTitle Object oHeaderGraphic is a BitmapContainer Set Location To 0 317 Set Size To 38 40 Set Color To clWhite Set Border_Style To Border_None Set Bitmap_Style To Bitmap_Center Set Bitmap To (psHeaderGraphic (Self)) End_Object // oHeaderGraphic End_Object // oHeader Object oLineControl is a LineControl Set Size to 2 362 Set Location to 37 0 End_Object // oLineControl End_Procedure // Construct_Object Procedure Set psTitle String sValue Set Label Of (oTitle (oHeader (Self))) To sValue End_Procedure // Set psTitle Function psTitle Returns String String sTitle Get Label Of (oTitle (oHeader (Self))) To sTitle Function_Return sTitle End_Function // psTitle Procedure Set psSubTitle String sValue Set Label Of (oSubTitle (oHeader (Self))) To sValue End_Procedure // Set psSubTitle Function psSubTitle Returns String String sSubTitle Get Label Of (oSubTitle (oHeader (Self))) To sSubTitle Function_Return sSubTitle End_Function // psSubTitle End_Class // cInteriorPage Class cWelcomePage Is A cExteriorPage Procedure Construct_Object Forward Send Construct_Object Set pbWelcomePage To True Set pbCompletionPage To False End_Procedure // Construct_Object End_Class // cWelcomePage Class cCompletionPage Is A cExteriorPage Procedure Construct_Object Forward Send Construct_Object Set pbWelcomePage To False Set pbCompletionPage To True End_Procedure // Construct_Object End_Class // cCompletionPage