This repository has been archived on 2024-12-02. You can view files and clone it, but cannot push or open issues or pull requests.
AlonsoYSal_FactuGES/Servidor/uConfiguracion.pas
2007-06-21 16:02:50 +00:00

109 lines
2.6 KiB
ObjectPascal

unit uConfiguracion;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ActnList, JvComponent,
JvAppStorage, JvAppRegistryStorage, Contnrs, ExtCtrls, ImgList,
PngImageList, JvExControls, JvGradientHeaderPanel, uFrameConfiguracion,
JvComponentBase;
type
TfConfiguracion = class(TForm)
tvArbol: TTreeView;
Button1: TButton;
Button2: TButton;
ActionList1: TActionList;
actAceptar: TAction;
actCancelar: TAction;
JvAppRegistryStorage1: TJvAppRegistryStorage;
pnlPagina: TTabControl;
PngImageList1: TPngImageList;
pnlHeader: TJvGradientHeaderPanel;
procedure FormCreate(Sender: TObject);
procedure tvArbolChange(Sender: TObject; Node: TTreeNode);
procedure actAceptarExecute(Sender: TObject);
procedure actCancelarExecute(Sender: TObject);
private
FPaginaActual : IConfiguracionFrame;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
var
fConfiguracion: TfConfiguracion;
implementation
uses uConexionBD, uDataModuleServer, uConfGeneral;
{$R *.dfm}
type
TFrameClass = class of TFrameConfiguracion;
function CreateFrame(Parent: TWinControl; FrameClass: TFrameClass): IConfiguracionFrame;
var
aFrame : TFrameConfiguracion;
begin
aFrame := FrameClass.Create(NIL);
aFrame.Name:='Frame'+IntToStr(Random(10000));
aFrame.Parent := Parent;
aFrame.Init;
aFrame.Show;
Result := aFrame;
end;
constructor TfConfiguracion.Create(AOwner: TComponent);
begin
inherited;
end;
destructor TfConfiguracion.Destroy;
begin
inherited;
end;
procedure TfConfiguracion.FormCreate(Sender: TObject);
var
ANode: TTreeNode;
begin
with tvArbol.Items do
begin
ANode := AddChild(NIL, 'General');
ANode.ImageIndex := ANode.Index;
ANode := AddChild(NIL, 'Conexión con servidor de BD');
ANode.ImageIndex := ANode.Index;
end;
end;
procedure TfConfiguracion.tvArbolChange(Sender: TObject; Node: TTreeNode);
begin
if Assigned(FPaginaActual) then
FPaginaActual.Finalize;
case Node.Index of
0 : FPaginaActual := CreateFrame(pnlPagina, TfrConfGeneral);
1 : FPaginaActual := CreateFrame(pnlPagina, TfrConexionBD);
end;
Self.Update;
pnlHeader.LabelCaption := Node.Text;
end;
procedure TfConfiguracion.actAceptarExecute(Sender: TObject);
begin
if Assigned(FPaginaActual) then
FPaginaActual.Finalize;
dmServer.SalvarConfiguracion;
Close;
end;
procedure TfConfiguracion.actCancelarExecute(Sender: TObject);
begin
Close;
end;
end.