Subject | Re: [IBO] LookupCombo drop-down lists displays with error |
---|---|
Author | bytelord |
Post date | 2004-04-06T16:10:56Z |
I am using TIB_LookupCombo.
All my lookupcombos go through this procedure to make sure their
display properties are allways the same:
//============================================
procedure PreparaLookUpCombo(var combo:TIB_LookUpCombo; var
q:TIB_Query; SQL:string; source:TIB_DataSource; slink,dField:string;
items,links,gLinks:TIB_stringList; orden:integer);
begin
with combo do begin
AutoDropDown := true;
AutoLabel.Options :=
[albAlignToModel,albOnlyFirstCharUpper,albBoldIfRequired];
ColLines := true;
DisplayField := dField;
IndicateTitles := true;
GridLinks := gLinks;
PreventDeleting := true;
DropDownCount := 12;
PopupAlignment := puAuto;
ReadOnly := false;
SearchKeybyKey := true;
AllowTimeOut := false;
showbutton := true;
end;
with q do begin
KeySource := source;
KeyLinks.Clear;
KeyLinks.Add(slink);
OrderingItems := items;
OrderingLinks := links;
if orden > 0 then
OrderingItemNo := orden
else
OrderingItemNo := 1;
end;
AbreSQL(q,SQL);
end;
//==========================================
Then, in my forms I prepare the variables and call this procedure,
like this:
// ===============================================
procedure TFormAlta.AbreCombos;
var
s,key : string;
items, links, glink : TIB_StringList;
begin
items := TIB_StringList.Create;
links := TIb_StringList.Create;
glink := TIb_StringList.Create;
// this one displays OK
// dsConc is the master datasource for all the lookupcombos
// cbDir is the lookupcombo's name
// ibqDir is the lookupcombo's query
s := 'select CLAVE, DESCRIPCION from ZCAT_DIRECCIONES where ACTIVO
= '''+'1'+'''';
key := 'ZCAT_DIRECCIONES.CLAVE = CONCURSOS.DIRECCION';
items.Clear;
items.Add('Direccion=DESCRIPCION;DESCRIPCION DESC');
links.Clear;
links.Add('DESCRIPCION=1');
glink.Clear;
data.PreparaLookUpCombo
(cbDir,ibqDir,s,dsConc,key,'DESCRIPCION',items,links,glink,1);
// this one displays OK
s := 'select CLAVE, DESCRIPCION from ZCAT_CLASE_CONTRATO where
ACTIVO = '''+'1'+''' '+
'and CLAVE <> '''+'OTR'+'''';
key := 'ZCAT_CLASE_CONTRATO.CLAVE = CONCURSOS.CLASE_CONTRATO';
items.Clear;
items.Add('Tipo de Contrato=DESCRIPCION;DESCRIPCION DESC');
links.Clear;
links.Add('DESCRIPCION=1');
glink.Clear;
data.PreparaLookUpCombo
(cbTipo,ibqTipo,s,dsConc,key,'DESCRIPCION',items,links,glink,1);
// this one displays OK
s := 'select CLAVE, DESCRIPCION from ZCAT_TIPO_ADJ where ACTIVO
= '''+'1'+'''';
key := 'ZCAT_TIPO_ADJ.CLAVE = CONCURSOS.TIPO_ADJ';
items.Clear;
items.Add('Tipo de AdjudicaciĆ³n=DESCRIPCION;DESCRIPCION DESC');
links.Clear;
links.Add('DESCRIPCION=1');
glink.Clear;
data.PreparaLookUpCombo
(cbAdj,ibqAdj,s,dsConc,key,'DESCRIPCION',items,links,glink,1);
// this one fails to display correctly at the user's first click
s := 'select CLAVE, CODIGO, CUENTA, PREVIO, SALDO, ID, OBRA '+
'from PREVIOS where OBRA = '''+clave_obra+''' '+
'and SALDO > 0';
// ID is a computed field in the database:
// CLAVE || ':' || CODIGO || ':' CUENTA
key := 'PREVIOS.CLAVE = CONCURSOS.PREVIO';
items.Clear;
items.Add('Codigo=CODIGO; CODIGO DESC');
items.Add('Cuenta=CUENTA; CUENTA DESC');
items.Add('Previo=PREVIO; PREVIO DESC');
items.Add('Saldo=SALDO; SALDO DESC');
links.Clear;
links.Add('CODIGO=1');
links.Add('CUENTA=2');
links.Add('PREVIO=3');
links.Add('SALDO=4');
glink.Clear;
glink.Add('CODIGO');
glink.Add('CUENTA');
glink.Add('PREVIO');
glink.Add('SALDO=WIDTH=95=ALIGN=R');
data.PreparaLookUpCombo
(cbPrevio,ibqPrevio,s,dsConc,key,'ID',items,links,glink,4);
items.Free;
links.Free;
glink.Free;
end;
// ===============================================
All my lookupcombos go through this procedure to make sure their
display properties are allways the same:
//============================================
procedure PreparaLookUpCombo(var combo:TIB_LookUpCombo; var
q:TIB_Query; SQL:string; source:TIB_DataSource; slink,dField:string;
items,links,gLinks:TIB_stringList; orden:integer);
begin
with combo do begin
AutoDropDown := true;
AutoLabel.Options :=
[albAlignToModel,albOnlyFirstCharUpper,albBoldIfRequired];
ColLines := true;
DisplayField := dField;
IndicateTitles := true;
GridLinks := gLinks;
PreventDeleting := true;
DropDownCount := 12;
PopupAlignment := puAuto;
ReadOnly := false;
SearchKeybyKey := true;
AllowTimeOut := false;
showbutton := true;
end;
with q do begin
KeySource := source;
KeyLinks.Clear;
KeyLinks.Add(slink);
OrderingItems := items;
OrderingLinks := links;
if orden > 0 then
OrderingItemNo := orden
else
OrderingItemNo := 1;
end;
AbreSQL(q,SQL);
end;
//==========================================
Then, in my forms I prepare the variables and call this procedure,
like this:
// ===============================================
procedure TFormAlta.AbreCombos;
var
s,key : string;
items, links, glink : TIB_StringList;
begin
items := TIB_StringList.Create;
links := TIb_StringList.Create;
glink := TIb_StringList.Create;
// this one displays OK
// dsConc is the master datasource for all the lookupcombos
// cbDir is the lookupcombo's name
// ibqDir is the lookupcombo's query
s := 'select CLAVE, DESCRIPCION from ZCAT_DIRECCIONES where ACTIVO
= '''+'1'+'''';
key := 'ZCAT_DIRECCIONES.CLAVE = CONCURSOS.DIRECCION';
items.Clear;
items.Add('Direccion=DESCRIPCION;DESCRIPCION DESC');
links.Clear;
links.Add('DESCRIPCION=1');
glink.Clear;
data.PreparaLookUpCombo
(cbDir,ibqDir,s,dsConc,key,'DESCRIPCION',items,links,glink,1);
// this one displays OK
s := 'select CLAVE, DESCRIPCION from ZCAT_CLASE_CONTRATO where
ACTIVO = '''+'1'+''' '+
'and CLAVE <> '''+'OTR'+'''';
key := 'ZCAT_CLASE_CONTRATO.CLAVE = CONCURSOS.CLASE_CONTRATO';
items.Clear;
items.Add('Tipo de Contrato=DESCRIPCION;DESCRIPCION DESC');
links.Clear;
links.Add('DESCRIPCION=1');
glink.Clear;
data.PreparaLookUpCombo
(cbTipo,ibqTipo,s,dsConc,key,'DESCRIPCION',items,links,glink,1);
// this one displays OK
s := 'select CLAVE, DESCRIPCION from ZCAT_TIPO_ADJ where ACTIVO
= '''+'1'+'''';
key := 'ZCAT_TIPO_ADJ.CLAVE = CONCURSOS.TIPO_ADJ';
items.Clear;
items.Add('Tipo de AdjudicaciĆ³n=DESCRIPCION;DESCRIPCION DESC');
links.Clear;
links.Add('DESCRIPCION=1');
glink.Clear;
data.PreparaLookUpCombo
(cbAdj,ibqAdj,s,dsConc,key,'DESCRIPCION',items,links,glink,1);
// this one fails to display correctly at the user's first click
s := 'select CLAVE, CODIGO, CUENTA, PREVIO, SALDO, ID, OBRA '+
'from PREVIOS where OBRA = '''+clave_obra+''' '+
'and SALDO > 0';
// ID is a computed field in the database:
// CLAVE || ':' || CODIGO || ':' CUENTA
key := 'PREVIOS.CLAVE = CONCURSOS.PREVIO';
items.Clear;
items.Add('Codigo=CODIGO; CODIGO DESC');
items.Add('Cuenta=CUENTA; CUENTA DESC');
items.Add('Previo=PREVIO; PREVIO DESC');
items.Add('Saldo=SALDO; SALDO DESC');
links.Clear;
links.Add('CODIGO=1');
links.Add('CUENTA=2');
links.Add('PREVIO=3');
links.Add('SALDO=4');
glink.Clear;
glink.Add('CODIGO');
glink.Add('CUENTA');
glink.Add('PREVIO');
glink.Add('SALDO=WIDTH=95=ALIGN=R');
data.PreparaLookUpCombo
(cbPrevio,ibqPrevio,s,dsConc,key,'ID',items,links,glink,4);
items.Free;
links.Free;
glink.Free;
end;
// ===============================================
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 01:50 AM 6/04/2004 +0000, you wrote:
> >I have a from with 5 different LookupCombos. All of them are
working
> >fine except one.
> >
> >When the user opens the form and clicks any of the combos, the
drop-
> >down list of the first 4 LookupCombos appears using the space it
> >needs to show all of it's columns.
> >
> >When the user clicks the 5th one, the drop-down list shows only
part
> >of the column titles and the horizontal and vertical scrollbars.
The
> >user can still navigate to the value he wants with the scroll bars
> >and select it. If he clicks again, now the list appears complete
and
> >without scroll bars, just as the other four lists do.
> >
> >The properties of all 5 LookupCombos are the same, they go
through a
> >"PrepareCombo" procedure to make sure of that. The only
difference is
> >that the erratic combo shows 4 columns and the other four shows
just
> >2 columns.
>
> Are you talking about TIB_LookupCombo or the VCL one?
>
> Helen