Subject Re: [IBO] AutoLabel Issue
Author Geoff Worboys
Hi,

> in this monent, the autolabel will bold caption if in Insert
> or Edit mode , why is it different with enhanced componet
> tlabelenh , i'm now want to decide use autolabel or still
> use tlabelenh for field label

In early april I posted the following message to the list, which
explains how this "feature" came to be...

- - - - - -
The AutoLabel feature of the IBO controls has an Option setting which
makes the label Bold for mandatory fields. At the moment this works
by simply checking the IsNullable setting of the column (and then it
also checks if there is a DefaultValue available).

I am considering is changing this so that it also checks the ReadOnly
and Required properties of the column.

By adding the check for ReadOnly or (not Required) we can exclude
additional columns from being bolded in AutoLabel. I often set a
column to readonly to prevent it from being included in the update,
letting the server trigger processing take care of the value.
Similarly you can use the NOTREQUIRED column attribute to allow server
trigger processing to take care of setting certain columns rather than
have IBO insist that a value is entered.

The change would introduce an unexpected "feature". In search mode
all columns return ReadOnly=true, so in search mode no labels are
bold. In some respects this is OK, since nothing is really mandatory
in search mode, but since the labels show bold even Browse mode I am
not certain I like the inconsistency.

I could avoid this by only using the Required check but this means
additional Fields* properties settings in some cases that I didn't
really want.

I could also avoid the problem by only returning mandatory in
dssInsert and dssEdit modes, having the fields always have a plain
label in non-editing states. I think I like this option better.

- - - - - -


At the time I asked for input, got positive feedback and decided to
implement.


> ?
> or will have any new feature in future which bold alway if
> the field is compulsory
> ?

If you are using TLabelEnh from the EnhComponents then you need to
know that TLabelEnh will be dropped in the new version of the
EnhComponents to be released to work with IBO4. TLabelEnh was renamed
to TIB_Label and included in IBO (AutoLabel is actually an instance of
TIB_Label) so I saw no reason to keep TLabelEnh. (Although there is
no reason you could not keep the old unit going for your own purposes
if desired.)

As for changes to allow revert to the previous style of bolding...

The code that makes this decision was isolated from the label class
into a utility function (see IsIBColumnMandatory in IBC_Label.pas).
This makes it less convenient to manage via class properties. Since I
have already setup a set of global values to permit control over
AutoLabel defaults (see the botton of the IBC_Label.pas unit), it
occurred to me that I could provide a new global, something like...

IB_AutoLabel_BoldStates := [dssInsert,dssEdit];

that you could change at runtime to have the labels operate in other
modes, such as...

IB_AutoLabel_BoldStates := [dssBrowse,dssInsert,dssEdit];

It would not be useful in dssSearch mode since all fields return
ReadOnly. Would this be acceptable?

(NOTE: In the short term you could add dssBrowse the the state check
in the IsIBColumnMandatory function to see if you like this mode of
operation.)


Geoff Worboys
Telesis Computing