Grid -> Guardar la configuración en un fichero XML en vez del registro de Windows.

git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@494 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
David Arranz 2008-08-04 10:58:36 +00:00
parent e40cf73e67
commit 63125630f1
3 changed files with 57 additions and 3 deletions

View File

@ -4,6 +4,7 @@ inherited fEditorGridBase: TfEditorGridBase
Caption = 'fEditorGridBase'
ClientHeight = 444
ClientWidth = 543
OnDestroy = CustomEditorDestroy
ExplicitWidth = 551
ExplicitHeight = 478
PixelsPerInch = 96

View File

@ -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;

View File

@ -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