Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firemonkey: Styling the tGrid or alternative Grid/List components (Virtual)

I'm trying to create my first app based on FireMonkey, and I hit a wall. The only virtual list control I can find is tGrid.

This component is pretty good, but I can not figure out how to extend or customize it. I get that there is tCheckbox column, tImage column etc, but what if I need a ButtonColumn or something like this?

Also I would like to style a row, based on the state of the data it represents.

An Example: if the data that is represented in the row has "Error=True" it should be displayed in red.

Has anyone got a similar problem? Or found alternate virtual list/grid components? Or even just some tips on use of the tGrid component. These components are pretty essential in all database apps so it should be a pretty common request.

Also just as a note, I don't think the TGrid supports Drag & Drop of rows?

I have looked at Firemonkey version of VirtualTreeView and Firemonkey and large amounts of data

like image 647
Artis De Partis Avatar asked Nov 02 '11 21:11

Artis De Partis


1 Answers

If you look at the sources, TCheckColumn is only 15 code lines. If you need to create your own column descendant class it's quite straightforward. This is one solution, otherwise you can dynamically create some components in your cells and then cast the children when checking the props (TColumn.CellControlByRow() return a TControl and the children would be what you have put in there).

As you want to 'style' your row I would suggest you to write your own TColumn class, even if you can do painting in the OnPaint Event.

like image 112
az01 Avatar answered Sep 30 '22 04:09

az01