Subject | RE: [IBO] Grid and LookupCombo - Lokkup popup list width |
---|---|
Author | Claudio Valderrama C. |
Post date | 2001-05-12T04:58:18Z |
> -----Original Message-----I always have believed this is a bug in TIB_lookupCombo. Maybe it isn't, but
> From: nforall@... [mailto:nforall@...]
> Sent: Lunes 30 de Abril de 2001 6:19
>
> BTW, why LookupCombo displays so small popup list?
> I mean - my field DEPNAME has CHAR(50), but Combo's
> popup list width is much smaller and displays only 17-18
> characters. Changes to Display Width for DEPNAME not
> helps.
it's annoying. Hence, I have the following code in the base form of my
projects:
procedure TFormBase.IB_LookupComboDropDownWidth(Sender: TObject);
var
w, iter: Integer;
begin
inherited;
w := 0;
With (Sender as TIB_LookupCombo), DataSource.Dataset do
begin
for iter := 0 to FieldCount - 1 do
if Fields[iter].Visible
then Inc(w, Fields[iter].DisplayWidth);
DropDownWidth := w
end
end;
You have to use the OnDropDown event of the lookup and call this function,
passing the same Sender than the event handler receives. It has drawbacks:
it's not valid if you use TIB_LookupCombo's GridLinks property. In that
case, you could modify it to query GridLinks to know the list of fields
available for display instead of querying Fields[i].Visible.
C.