diff --git a/Source/GUIBase/uEditorGridBase.dfm b/Source/GUIBase/uEditorGridBase.dfm index 23d50433..6fe919ea 100644 --- a/Source/GUIBase/uEditorGridBase.dfm +++ b/Source/GUIBase/uEditorGridBase.dfm @@ -4,6 +4,7 @@ inherited fEditorGridBase: TfEditorGridBase Caption = 'fEditorGridBase' ClientHeight = 444 ClientWidth = 543 + OnDestroy = CustomEditorDestroy ExplicitWidth = 551 ExplicitHeight = 478 PixelsPerInch = 96 diff --git a/Source/GUIBase/uEditorGridBase.pas b/Source/GUIBase/uEditorGridBase.pas index d2fcbeec..61463beb 100644 --- a/Source/GUIBase/uEditorGridBase.pas +++ b/Source/GUIBase/uEditorGridBase.pas @@ -70,6 +70,7 @@ type procedure actRefrescarUpdate(Sender: TObject); procedure actFiltrarExecute(Sender: TObject); procedure actFiltrarUpdate(Sender: TObject); + procedure CustomEditorDestroy(Sender: TObject); protected FViewGrid : IViewGridBase; procedure SetViewGrid(const Value : IViewGridBase); virtual; @@ -154,9 +155,10 @@ procedure TfEditorGridBase.FormShow(Sender: TObject); begin inherited; if Assigned(ViewGrid) then - ViewGrid.ShowEmbedded(Self); - - + begin + ViewGrid.ShowEmbedded(Self); + ViewGrid.RestoreFromIniFile; + end; end; procedure TfEditorGridBase.actEliminarUpdate(Sender: TObject); @@ -247,6 +249,13 @@ begin actModificar.ShortCut := ShortCut(VK_RETURN, []); end; +procedure TfEditorGridBase.CustomEditorDestroy(Sender: TObject); +begin + inherited; + if Assigned(ViewGrid) then + ViewGrid.StoreToIniFile; +end; + procedure TfEditorGridBase.actAnchoAutoExecute(Sender: TObject); begin inherited; diff --git a/Source/GUIBase/uViewGridBase.pas b/Source/GUIBase/uViewGridBase.pas index f624c1cb..0ff62fac 100644 --- a/Source/GUIBase/uViewGridBase.pas +++ b/Source/GUIBase/uViewGridBase.pas @@ -44,6 +44,9 @@ type function GetGrid : TcxGrid; property _Grid : TcxGrid read GetGrid; + procedure RestoreFromIniFile; + procedure StoreToIniFile; + procedure StoreToRegistry (const Path : String); procedure RestoreFromRegistry (const Path : String); @@ -145,6 +148,9 @@ type procedure SaveGridStatus; procedure RestoreGridStatus; + procedure RestoreFromIniFile; + procedure StoreToIniFile; + procedure GotoFirst; procedure GotoLast; @@ -392,12 +398,50 @@ begin Filter := ViewFiltros.Texto; end; +procedure TfrViewGridBase.RestoreFromIniFile; +var + AIniFile : String; +begin + Exit; + inherited; + if Assigned(_FocusedView) then + begin + + AIniFile := GetSpecialFolderPath(CSIDL_COMMON_APPDATA); //[All Users]\Application Data + AIniFile := AIniFile + PathDelim + 'Rodax Software' + PathDelim + GetAppName + PathDelim; + + if not DirectoryExists(AIniFile) then + ForceDirectories(AIniFile); + + _FocusedView.RestoreFromIniFile(AIniFile + 'grid.xml', True, False, []); + end; +end; + procedure TfrViewGridBase.RestoreFromRegistry(const Path : String); begin if Assigned(_FocusedView) then _FocusedView.RestoreFromRegistry(Path + '\\GridSettings\\' + Self.Name, False, False, []); end; +procedure TfrViewGridBase.StoreToIniFile; +var + AIniFile : String; +begin + inherited; + Exit; + if Assigned(_FocusedView) then + begin + + AIniFile := GetSpecialFolderPath(CSIDL_COMMON_APPDATA); //[All Users]\Application Data + AIniFile := AIniFile + PathDelim + 'Rodax Software' + PathDelim + GetAppName + PathDelim; + + if not DirectoryExists(AIniFile) then + ForceDirectories(AIniFile); + + _FocusedView.StoreToIniFile(AIniFile + 'grid.xml', False, []); + end; +end; + procedure TfrViewGridBase.StoreToRegistry(const Path : String); begin if Assigned(_FocusedView) then