{ =============================================================================== Copyright (©) 2006. Rodax Software. =============================================================================== Los contenidos de este fichero son propiedad de Rodax Software titular del copyright. Este fichero sólo podrá ser copiado, distribuido y utilizado, en su totalidad o en parte, con el permiso escrito de Rodax Software, o de acuerdo con los términos y condiciones establecidas en el acuerdo/contrato bajo el que se suministra. ----------------------------------------------------------------------------- Web: www.rodax-software.com =============================================================================== Fecha primera versión: 22-05-2006 Versión actual: 1.0.0 Fecha versión actual: 22-05-2006 =============================================================================== Modificaciones: Fecha Comentarios --------------------------------------------------------------------------- =============================================================================== } unit uEditorConexiones; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, DB, uDADataTable, ActnList, Grids, DBGrids, StdCtrls, ComCtrls, uDAInterfaces, Mask, DBCtrls; type TfEditorConexiones = class(TForm) ActionList1: TActionList; dsFormasPago: TDADataSource; actAnadir: TAction; actEliminar: TAction; bEliminar: TButton; actAceptar: TAction; actCancelar: TAction; bAceptar: TButton; bCancelar: TButton; PageControl1: TPageControl; TabSheet1: TTabSheet; Label1: TLabel; bAnadir: TButton; actModificar: TAction; Button1: TButton; ListBox1: TListBox; procedure actCancelarExecute(Sender: TObject); procedure actAceptarExecute(Sender: TObject); procedure actModificarExecute(Sender: TObject); procedure actAnadirExecute(Sender: TObject); procedure actEliminarExecute(Sender: TObject); procedure actModificarUpdate(Sender: TObject); procedure actEliminarUpdate(Sender: TObject); private FListaConexiones : TStringList; function GetListaConexiones: TStringList; procedure SetListaConexiones(const Value: TStringList); procedure RellenarLista; procedure GuardarLista; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; property ListaConexiones : TStringList read GetListaConexiones write SetListaConexiones; end; implementation {$R *.dfm} { TfEditorConexiones } uses uDialogUtils, uConfigurarConexion; procedure TfEditorConexiones.actAceptarExecute(Sender: TObject); begin GuardarLista; ModalResult := mrOk; end; procedure TfEditorConexiones.actAnadirExecute(Sender: TObject); begin with TfConfigurarConexion.Create(NIL) do begin try TargetURL := ''; if ShowModal = mrOk then ListBox1.Items.Add(TargetURL); finally Release; end; end; end; procedure TfEditorConexiones.actCancelarExecute(Sender: TObject); begin ModalResult := mrCancel; end; procedure TfEditorConexiones.actEliminarExecute(Sender: TObject); begin ListBox1.Items.Delete(ListBox1.ItemIndex); end; procedure TfEditorConexiones.actEliminarUpdate(Sender: TObject); begin (Sender as TAction).Enabled := (ListBox1.ItemIndex >= 0) end; procedure TfEditorConexiones.actModificarExecute(Sender: TObject); begin with TfConfigurarConexion.Create(NIL) do begin try TargetURL := ListBox1.Items[ListBox1.ItemIndex]; if ShowModal = mrOk then ListBox1.Items[ListBox1.ItemIndex] := TargetURL; finally Release; end; end; end; procedure TfEditorConexiones.actModificarUpdate(Sender: TObject); begin (Sender as TAction).Enabled := (ListBox1.ItemIndex >= 0) end; constructor TfEditorConexiones.Create(AOwner: TComponent); begin inherited; FListaConexiones := TStringList.Create; end; destructor TfEditorConexiones.Destroy; begin FreeAndNil(FListaConexiones); inherited; end; function TfEditorConexiones.GetListaConexiones: TStringList; begin Result := FListaConexiones; end; procedure TfEditorConexiones.GuardarLista; var i : integer; begin FListaConexiones.Clear; for i := 0 to ListBox1.Count - 1 do FListaConexiones.Add(ListBox1.Items[i]); end; procedure TfEditorConexiones.RellenarLista; begin with ListBox1 do begin Clear; Items.AddStrings(FListaConexiones); end; end; procedure TfEditorConexiones.SetListaConexiones(const Value: TStringList); begin FListaConexiones.Clear; FListaConexiones.AddStrings(Value); RellenarLista; end; end.