//**************************************************************************** // $Module type: CLASS // $Module name: cPathButton.pkg // $Author : Nils G. Svedmyr // Created : 2002-08-15 @ 12:24 // // Description : // // $Rev History // 2002-08-15 Module header created //**************************************************************************** Use cBitmapButton.pkg Use SyncFuncs.pkg Use cRDSOpenDialog.pkg // Visual DataFlex 12.0 Migration Utility, added March 28, 2007: 15:13:24 #IF (!@ >= 120) { OverrideProperty=Bitmap InitialValue="FolderO16.bmp" } { OverrideProperty=piTransparentColor InitialValue=clWhite } { OverrideProperty=Label InitialValue="&Select File" } { OverrideProperty=Status_Help InitialValue="Click to activate the Open File Dialog and select a database table." } { OverrideProperty=Bitmap_Style InitialValue=Bitmap_Actual } { OverrideProperty=Bitmap_Style DesignTime=False } { OverrideProperty=Enabled_State InitialValue=False } { OverrideProperty=Default_State InitialValue=False } #ENDIF Class cPathButton is a cBitmapButton Procedure Construct_Object Forward Send Construct_Object // Visual DataFlex 12.0 Migration Utility, added March 28, 2007: 15:13:25 #IF (!@ >= 120) { InitialValue=True } #ENDIF Property Boolean pbFrom True Property Integer piDbType 0 Property Handle phoDD (Main_DD(Self)) Set Enabled_State To False End_Procedure // Construct_Object Procedure End_Construct_Object Forward Send End_Construct_Object End_Procedure // End_Construct_Object Procedure DoEnableDisable Integer iValue Set piDbType To iValue // showln "ipiDbType = " iValue Set Enabled_State To (iValue = 1 Or iValue = 6) End_Procedure // DoEnableDisable Procedure DoOpenFileDialog Handle hoDD hoDialog hoPathObject hoDbObject hoServerObject hoDbType String sValue sFile sPath sOldPath sText sFilter sOldVal Integer iType iFile iField iMode Boolean bOpen Get phoDD To hoDD If (pbFrom(Self)) Begin Get Field_Current_Value Of hoDD Field SncTable.FromDbType To iType Get Field_Current_Value Of hoDD Field SncTable.FromFilePath To sOldPath Get DDObjectId hoDD SncTable.File_Number "FromDbType" To hoDbType Get DDObjectId hoDD SncTable.File_Number "FromServer" To hoServerObject Get DDObjectId hoDD SncTable.File_Number "FromFilePath" To hoPathObject Get DDObjectId hoDD SncTable.File_Number "FromDataTable" To hoDbObject End // If (pbFrom(Self)) Begin Else Begin Get Field_Current_Value Of hoDD Field SncTable.ToDbType To iType Get Field_Current_Value Of hoDD Field SncTable.ToFilePath To sOldPath Get DDObjectId hoDD SncTable.File_Number "ToDbType" To hoDbType Get DDObjectId hoDD SncTable.File_Number "ToServer" To hoServerObject Get DDObjectId hoDD SncTable.File_Number "ToFilePath" To hoPathObject Get DDObjectId hoDD SncTable.File_Number "ToDataTable" To hoDbObject End // Else Begin Get Data_File Of hoPathObject Item 0 To iFile Get Data_Field Of hoPathObject Item 0 To iField Get File_Field_Current_Value Of hoDD iFile iField To sOldVal If (iType = 1) Begin Move "DataFlex Data Tables *.Dat|*.Dat" To sFilter Move "Please Select a DataFlex Data Table" To sText End // If (iType = 1) Begin Else If (iType = 6) Begin Move "Pervasive.SQL Meta Data File (File.ddf)|File.ddf" To sFilter Move "Please Select a Pervasive Meta Data file (File.ddf)" To sText End // Else If (iType = 6) Begin Get Create U_cRDSOpenDialog To hoDialog Set Dialog_Caption Of hoDialog To sText Set Filter_String Of hoDialog To sFilter If (Length(sOldVal) > 0) ; Set Initial_Folder Of hoDialog To sOldVal Get Show_Dialog Of hoDialog To bOpen Get File_Name Of hoDialog To sValue Send Destroy Of hoDialog If Not bOpen Procedure_Return Get StripFile sValue To sPath // Sysfuncs.pkg Get StripPath sValue To sFile // Sysfuncs.pkg // Get UpperFirstChar sFile To sFile // Sysfuncs.pkg // If (Trim(sOldVal) <> Trim(sPath)) ; Set File_Field_Changed_Value Of hoDD iFile iField To sPath If (iType = 1) Begin // DataFlex Get Data_File Of hoDbObject Item 0 To iFile Get Data_Field Of hoDbObject Item 0 To iField // 2003-05-26 ------------------------------------ Start Nils G. Svedmyr // Special fix. It turns out that due to optimization in the DD class and // optimization in the comboform class, the DD buffer value will _not_ get // uppated if the focus is at the hoDbObject. This will fix it. If (Focus(Desktop) = hoDbObject) Send Activate Of hoDbType Set File_Field_Changed_Value Of hoDD iFile iField To sFile Send Request_Entry_Update Of hoDD iFile True Send DoRefreshCombo Of hoDbObject // Send Activate Of hoDbObject // 2003-05-26 ------------------------------------ Stop Nils G. Svedmyr End // If (iType = 1) Begin Else If (iType = 6) Begin // Pervasive.SQL Get Data_File Of hoServerObject Item 0 To iFile Get Data_Field Of hoServerObject Item 0 To iField Get File_Field_Current_Value Of hoDD iFile iField To sOldVal If (Trim(sOldVal) <> Trim(sFile) Or Trim(sOldPath) <> Trim(sPath)) Begin Set File_Field_Changed_Value Of hoDD iFile iField To sFile Send DoFindData Of hoServerObject End // If (Trim(sOldVal) <> Trim(sFile) Or Trim(sOldPath) <> Trim(sPath)) Begin End // Else If (iType = 6) Begin End_Procedure // DoOpenFileDialog End_Class // cPathButton