Subject AutoLabel - Bug
Author Claudio Kloss
Hi,

I found that AutoLabel wasn’t choosing the correct label between
“FieldsDisplayLabel” and “FieldsGridLabel”, always showing the label in
“FieldsGridLabel”, even when there were enough room to show the more
descriptive and longer version of label in “FieldsDisplayLabel”.

Checking the source code at unit IBC_Label, procedure TIB_Label.DoGetLabel,
I think I found the problem. See the excerpt below:

// if this name is too large try the grid name
if Canvas.TextWidth(AText) >= Width then begin
tmpStr := tmpCol.GridDisplayName;
if Length(tmpStr) > 0 then
AText := tmpStr;
end;
end


Changing the first line of code to this resolved the problem.

// if this name is too large try the grid name
if Canvas.TextWidth(AText) >= FocusControl.Width then begin // Get
the width from the control
tmpStr := tmpCol.GridDisplayName;
if Length(tmpStr) > 0 then
AText := tmpStr;
end;
end



Claudio F. Kloss
MicroLight Informática Ltda.
Juiz de Fora - MG
Brazil
email: ckloss@...