//**************************************************************************** // $Module type: CLASS // $Module name: FilForm // $Author : AKE // Created : 19-08-2003 08:46:00 // // Description // // $Rev History // 19-08-2003 Module header created //**************************************************************************** Use File_dlg.pkg Use cRegistry.pkg Class cFilFormReg is a cRegistry Function RegValue String sValue String sStandard Returns String String sRegKey sOuttxt sModule Boolean bopened Move sStandard to sOutTxt Get Module_Name to sModule Move ("Software\"+sModule) to sRegKey Set phRootKey to HKEY_CURRENT_USER Get OpenKey sRegKey to bOpened If bOpened Begin If (ValueExists(Self, sValue)) Begin Get ReadString sValue to sOutTxt End Send CloseKey End Function_Return sOutTxt End_Function Procedure Set RegValue String sValue String sTxt String sRegKey sModule Boolean bCreateFejl Get Module_Name to sModule Move ("Software\"+sModule) to sRegKey Set phRootKey to HKEY_CURRENT_USER Get CreateKey sRegKey to bCreateFejl If not bCreateFejl Begin Send WriteString sValue sTxt Send CloseKey End End_Procedure End_Class { OverrideProperty=Form_DataType InitialValue=Ascii_window } { OverrideProperty=Form_DataType DesignTime=False } { OverrideProperty=Prompt_Button_Mode InitialValue=pb_PromptOn } { OverrideProperty=Prompt_Button_Mode DesignTime=False } Class FilForm is a Form //**************************************************************************** // $Module type: PROCEDURE // $Module name: Construct_Object // $Author : AKE // Created : 19-08-2003 08:46:01 // // Description // // $Rev History // 19-08-2003 Module header created //**************************************************************************** Procedure Construct_Object Forward Send Construct_Object Property String RegistrationValueName public "" { InitialValue="V‘lg fil" } Property String Dialog_caption Public "V‘lg fil" { InitialValue="Alle filer (*.*)|*.*" } Property String Filter_String Public "Alle Filer (*.*)|*.*" //I.e. "Tekstfiler (*.txt)|*.txt|Alle filer (*.*)|*.*" { InitialValue=True } Property Boolean FileMustExist_State Public True { InitialValue=True } Property Boolean ShowFileTitle_State Public True { InitialValue=True } Property Boolean HideReadOnly_State Public True { InitialValue=False } Property Boolean CreatePrompt_State public False Set prompt_button_mode to PB_promptOn Object Openfile is an OpenDialog End_Object //Openfile Object oReg is a cFilFormReg End_Object End_Procedure // Construct_Object //**************************************************************************** // $Module type: PROCEDURE // $Module name: End_Construct_Object // $Author : AKE // Created : 19-08-2003 08:46:01 // // Description // // $Rev History // 19-08-2003 Module header created //**************************************************************************** Procedure End_Construct_Object Forward Send End_Construct_Object End_Procedure // End_Construct_Object Procedure Prompt Handle hoDialog Boolean bOpen bVal String sFileName sModule sRegValue sDir sFilter sVal Move (OpenFile(Self)) to hoDialog Get RegistrationValueName to sRegValue If (sRegValue <> "") Begin Get RegValue of oReg sRegValue "" to sDir Set Initial_Folder of hoDialog to sDir End Get Filter_String to sFilter If (sFilter <> "") Set Filter_String of hoDialog to sFilter Get Dialog_caption to sVal Set Dialog_caption of hoDialog to sVal Get Filter_String to sVal Set Filter_String of hoDialog to sVal Get FileMustExist_State to bVal Set FileMustExist_State of hoDialog to bVal Get ShowFileTitle_State to bVal Set ShowFileTitle_State of hoDialog to bVal Get HideReadOnly_State to bVal Set HideReadOnly_State of hoDialog to bVal Get CreatePrompt_State to bVal Set CreatePrompt_State of hoDialog to bVal Get Show_Dialog of hoDialog to bOpen If bOpen Begin Get File_Name of hoDialog to sFileName Set Value to sFileName If (sRegValue <> "") Begin Set RegValue of oReg sRegValue to sFilename End End End_Procedure // Vis den sidst valgte fil i formen n†r den bliver placeret p† sk‘rmen. Procedure Activating Integer iFail String sRegValue sDir Forward Get msg_Activating to iFail If (not(iFail)) Begin Get RegistrationValueName to sRegValue If (sRegValue <> "") Begin Get RegValue of oReg sRegValue "" to sDir Set Value to sDir End End Procedure_Return iFail End_Procedure End_Class // FilForm