unit uViewTienda; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uViewBase, ExtCtrls, StdCtrls, DB, uDADataTable, cxGraphics, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxDBEdit, cxControls, cxContainer, cxEdit, cxLabel, cxDBLabel, cxCurrencyEdit, cxSpinEdit, cxCheckBox, cxMemo, uDAInterfaces, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox, dxLayoutControl, uTiendasEmpresaController, uIntegerListUtils; type TfrViewTienda = class(TfrViewBase) cbTienda: TcxDBComboBox; dxLayoutControl1Group_Root: TdxLayoutGroup; dxLayoutControl1: TdxLayoutControl; dxLayoutControl1Item1: TdxLayoutItem; dxLayoutControl1Item2: TdxLayoutItem; cbVendedor: TcxDBLookupComboBox; dsVendedores: TDADataSource; procedure CustomViewCreate(Sender: TObject); procedure CustomViewDestroy(Sender: TObject); private FListaTiendas: TStringList; FListaIDTiendas: TIntegerList; public function getIDTienda: Integer; end; implementation {$R *.dfm} procedure TfrViewTienda.CustomViewCreate(Sender: TObject); var i: Integer; begin inherited; FListaTiendas := Nil; FListaIDTiendas := Nil; with TTiendasEmpresaController.Create do begin FListaTiendas := DarListaTiendas; FListaIDTiendas := DarListaIDTiendas; end; if Assigned(FListaTiendas) then with cbTienda.Properties.Items do begin BeginUpdate; try Clear; AddStrings(FListaTiendas); finally EndUpdate; end; cbTienda.ItemIndex := 0; end; end; procedure TfrViewTienda.CustomViewDestroy(Sender: TObject); begin inherited; if Assigned(FListaTiendas) then FreeAndNil(FListaTiendas); if Assigned(FListaIDTiendas) then FreeAndNil(FListaIDTiendas); end; function TfrViewTienda.getIDTienda: Integer; begin if FListaTiendas.IndexOf(cbTienda.Text) < 0 then Result := FListaTiendas.IndexOf(cbTienda.Text) else Result := FListaIDTiendas.Integers[FListaTiendas.IndexOf(cbTienda.Text)]; end; end.