Subject Re: [IBO] AutoLabel bug
Author Geoff Worboys
> I have noticed that if I put an IB_EditEnh or IB_Memo (I
> think this applies to every control that features an
> AutoLabel property) inside an IB_CtrlGrid and I set
> AutoLabel.Kind to albTop, everything works as expected.
> Setting it to albLeft, instead, seem to start an endless
> redrawing loop that almost blocks the entire application.

This sounds very similar to a problem experience with TIB_Grid
recently when Guido tried using DoubleBuffer painting. When
experimenting with that problem I put an IB_EditEnh on the grid with a
left label and got the loop.

I know that AutoLabel does a bit of fudge processing to try and
calculate the space required for the label when it is placed on the
left. Sounds like this may be incompatible with CtrlGrid.

In the short term I can only suggest that you use an independant
label. Try using TIB_Label and attaching the IB_EditEnh control to
its FocusControl property. This will have it operate similar to
AutoLabel - but it is not quite as dynamic, so you may need to
invalidate the form if you prepare a dataset after the form becomes
visible.

In the longer term it **may** be possible to find another way of doing
the label size calculations, but I dont have time to investigate right
now.


> Also, if Margin could be automatically set to 0 when albTop
> is selected I think it would be a useful thing.

I have always preferred to have the label aligned with the grid
contents (where practical). The default margin of 3 seems to do this
OK for both top and left labels.

I guess it may be possible to change the default depending on the
type - there is already an IsStored function to control storage of
defaults - however it does get a bit confusing working out when to
assign the default value without overriding intentional assignments.


If you use mostly albTop labels or some other default arrangment, you
can change the autolabel defaults by creating your own unit and adding
it to the IBO package (or your own package if you have one). In that
unit you simply need...

implementation
uses IBC_Label;

initialization
IB_AutoLabel_DefaultKind := albNone;
IB_AutoLabel_DefaultSuffix := '';
IB_AutoLabel_DefaultMargin := 3;
IB_AutoLabel_DefaultPosition := 0;
IB_AutoLabel_DefaultOptions := [];
IB_AutoLabel_IgnoreZeroDefault := true;


The above shows the actual/current defaults, simply change these to
suit what you use most often. For example I set
IB_AutoLabel_DefaultSuffix := ': ';
IB_AutoLabel_DefaultOptions := [albBoldIfRequired, albDotLeader];

If you decide to change DefaultKind be aware that you will endup with
multiple labels showing on the IBO forms (such as IBF_Browse etc).
Perhaps in the future we may setup IBO to use (and explicitly set)
AutoLabel in its own forms and avoid this problem.


HTH

Geoff Worboys
Telesis Computing