GtkD help

Mike Wey mike-wey at example.com
Sun Nov 19 13:59:10 UTC 2017


On 18-11-17 22:57, Ivan Trombley wrote:
> I have this small application for viewing select log data from a certain 
> game that I originally wrote in C++/Qt. For various reasons, I decided 
> to rewrite this app in D using gtk-d. First, I have to say that the 
> documentation for gtk-d is atrocious! However, I managed to cobble 
> together enough information to get 80% of it done.
> 
> I would like to be able to controll how the cells in a TreeView are 
> rendered (ie the text color used) but I'm not able to find any 
> information about how to do this. Does any one have experience here? If 
> so, can you please give me a clue?

To change how a cell is rendered you will need to add a CellRenderer to 
the column, a CellRendererText would be used for rendering text and it 
has a foreground property to change the text color.

A small example on using CellRenderers can be found here: 
https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/DemoMultiCellRenderer/DemoMultiCellRenderer.d

If the color needs to differ between the different rows you can use 
TreeViewColumn.addAttribute to map a property of an renderer to a value 
on the TreeModel.

If the color depends on the value of the cell 
TreeViewColumn.setCellDataFunc() is also an option.

-- 
Mike Wey


More information about the Digitalmars-d-learn mailing list