[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Why does the StyledCellLabelProvider.update() method repeat the 1st column text?

I think that switching from TableViewer to using a Table instead will make
this work for you.  Though your current problem is likely rooted in Table, I
think you're seeing it as a result of how TableViewer reacts to custom draw
events, which is more complex than a typical case.  If you were to use a
Table and just do the drawing in response to these events then I think it
would work.  For more info on using Table/Tree custom draw at the swt level
see
http://www.eclipse.org/articles/article.php?file=Article-CustomDrawingTableAndTreeItems/index.html .

The only other way to do this, which I would not suggest, would be to embed
Controls in the cells that are capable of drawing your content (eg.-
StyledTexts).  For an example of embedding Controls in Table/Tree cells see
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet149.java?view=co .

HTH,
Grant


"Justin Slocum" <slocumj@xxxxxxxxxx> wrote in message
news:72d478195a5cff27cb2ae34c50cf4e7a$1@xxxxxxxxxxxxxxxxxx
> Even more weirdness:
> I tried this again on Ubuntu 9.04/GNOME 2.26.1, and now I get the same
> problem as before, but I noticed that when I use the mouse to re-size the
> window, the text labels in the last column (column 2) flicker back and
> forth between the correct value: "row...column 2" and the wrong value
> "row...column 0". When I let go of the left mouse button, the value
> settles to "row ... column 0" --> the incorrect value. It's like there is
> a last event that is repainting the cells with the incorrect value before
> returning. The correct values are buried in there somewhere.
>
> I need to highlight or color-code certain sections of text in each cell,
> so I don't think I can just use ITableLabelProvider and getColumnText() /
> getColumnImage(). That is why I'm using StyledCellLabelProvider with its
> update() method. Is there another way for me to highlight or color
> sections of text in the cell in a Table without using
> StyledCellLabelProvider ?
>
> Thanks very much for looking into this.
>