rDBGrid how to get FieldAsDataBar to work?

25 views
Skip to first unread message

TheLion

unread,
Jan 14, 2023, 2:38:01 AM1/14/23
to Rosi Delphi Components
Dear Thomas/all,
I would like to display a Databar in by rDBGrid.
Tried to define the field name (a tfloatfield) in the property, but no effect.
Turned on OptionsEx2.CellCondition, but also no effect.
Documentation mentions "min/max limits and colors can be defined in design time dialog or in runtime", only I could not figure out how to get this to work.
Can you share an example please?

Thanks!

TheLion

unread,
Jan 14, 2023, 2:56:52 AM1/14/23
to Rosi Delphi Components
figured it out in the meantime...

    FieldsAsDataBar.Strings := ( 'fScore=0;100;1;Red;Lime');

does the trick for me.
Nice feature!

Op zaterdag 14 januari 2023 om 08:38:01 UTC+1 schreef TheLion:

Tomas Rosinsky

unread,
Jan 16, 2023, 4:45:50 PM1/16/23
to Rosi Delphi Components
Hi, 

Databar properties can be set in design time dialog easily:
rDBGrid_databar.jpg

You can also set or get the setting in runtime by prepared functions:

    { return FieldsAsDataBar settings for one field }
    function Fields_GetDataBarSettings(FieldName: string; var MinValue, MaxValue: double; var ValueType: TrDataBarText; var ColorFrom, ColorTo: TColor)
      : boolean;
    { set or update FieldsAsDataBar settings for one field }
    function Fields_SetDataBarSettings(FieldName: string; MinValue, MaxValue: double; ValueType: TrDataBarText = dbtPercent; ColorFrom: TColor = clNone;
      ColorTo: TColor = clNone): string;


Of course you can also define it manually by separated list as you used but it is not easilly readable.

I hope it helps.
Tomas


Dne sobota 14. ledna 2023 v 8:56:52 UTC+1 uživatel TheLion napsal:
Reply all
Reply to author
Forward
0 new messages