Jump to content
Lainkes

Add Icon in DBGrid cell

Recommended Posts

Hello,

 

I have a DBGrid with records.

On column contains a True of False value.

Now I want this to be changed into a green icon (True) of red icon (False).

And when clicking on the icon, it must be changed from T to F or F to T.

Any idea how I can achieve this?

 

Thanks

 

Lainkes

Share this post


Link to post
3 hours ago, Lainkes said:

Hello,

 

I have a DBGrid with records.

On column contains a True of False value.

Now I want this to be changed into a green icon (True) of red icon (False).

And when clicking on the icon, it must be changed from T to F or F to T.

Any idea how I can achieve this?

 

Thanks

 

Lainkes

Handle the OnDrawColumnCell event of the grid, in it call DefaultDrawColumnCell if the cell you are asked to draw is not one in the boolean column, draw the icon on the grid canvas if it is in your special column. The OnCellClick event fires on a mouse click on the cell. The attached dataset's current record is already set to the record shown in the row clicked on, so just change the field value if the click lands on your boolean cell.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×