Hello,
converting from TSMDBGrid. Found a few samples in respect to painting a row in a particular color depending on a field value, but all of them access the field value per index.
I have a field called OPERATION. Depending on the value of that field, the other columns for this particular row should be painted in a different color. When using the CellColoring event, how do I access the field value of a particular field by it's underlaying TDataSet field name.
Thanks,
Thomas
Row Color depending on a field value
Started by Thomas Steinmaurer, Nov 29 2010 11:21 PM
3 replies to this topic
#1
Posted 29 November 2010 - 11:21 PM
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and NexusDB V2
Upscene Productions: http://www.upscene.com
My blog: http://blog.upscene.com/thomas/
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and NexusDB V2
Upscene Productions: http://www.upscene.com
My blog: http://blog.upscene.com/thomas/
#2
Posted 30 November 2010 - 01:55 AM
Hello Thomas,
You may access to Column[x].Field property.
This property represents a Field of currently active record.
Best regards
You may access to Column[x].Field property.
This property represents a Field of currently active record.
CODE
var
Field: TField;
begin
Field := NextDBGrid1.Columns[ACol].Field;
if Field.AsInteger = 4 then CellColor := clRed;
Field: TField;
begin
Field := NextDBGrid1.Columns[ACol].Field;
if Field.AsInteger = 4 then CellColor := clRed;
Best regards
boki@bergsoft.net
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#3
Posted 30 November 2010 - 10:03 AM
Hello Boki,
I know that example, the thing is, I can't access the field/column by a numeric index. I need to access the field/column by its underlaying database table field name.
Thanks,
Thomas
I know that example, the thing is, I can't access the field/column by a numeric index. I need to access the field/column by its underlaying database table field name.
Thanks,
Thomas
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and NexusDB V2
Upscene Productions: http://www.upscene.com
My blog: http://blog.upscene.com/thomas/
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and NexusDB V2
Upscene Productions: http://www.upscene.com
My blog: http://blog.upscene.com/thomas/
#4
Posted 30 November 2010 - 08:30 PM
Hello Thomas,
There is a property for accessing column by it's name:
But I am not sure that this is what you need.
Best regards
There is a property for accessing column by it's name:
CODE
NextGrid1.ColumnByName['colname'].Width
But I am not sure that this is what you need.
Best regards
boki@bergsoft.net
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











