Re: Checking for the type of a CellRenderer



> Hi all,
>
>
> I've been trying to set some properties of Cellrenderer's in a TreeView,
> such as foreground color, sensitivity, ea.
> What I do now is that I iterate over the TreeView's columns, get the first
> cellrenderer, cast it to CellRendererText (because of the foreground
> color)
> and set the properties. This worked fine, until I started adding non-text
> cells (because of the cast, and setting foreground color).
>
> What I'm trying to find now is if there's a way of checking for the type
> of
> a CellRenderer, but I couldn't find anything that looked like it in the
> api
> reference.
> Any suggestions?

You can use dynamic_cast<> for this, with if/else blocks. It's not
particularly pretty, but it's how it's done in C++. You'll find some
examples of this in Glom's source code (though that's not always the
cleanest example code).


Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]