|Re: column content alignment [message #489120 is a reply to message #489049]
||Thu, 01 October 2009 14:38
| Grant Gayed
Registered: July 2009
The best way to do this is by drawing the items yourself. The basic steps
- add an EraseItem listener. When it's received:
- use the event's GC to measure the full string, if it does not fit then
remove the SWT.FOREGROUND bit from the event's detail
- add a PaintItem listener. When it's received:
- if the item did not fit when it was measured in the EraseItem listener
then use the event's GC to measure a string that will fit (eg.- replace the
first x characters with "...", measure it, if it doesn't fit then replace
the first x+2 characters with "..." measure it, etc.), then draw the string
with the GC
For info about TableItem/TreeItem custom draw see
http://www.eclipse.org/articles/article.php?file=Article-Cus tomDrawingTableAndTreeItems/index.html .
An alternative approach (not really recommended) would be to listen for
column Resize events, and when one is received calculate the shortened
strings for all items down the column and change their texts with
<email@example.com> wrote in message
> I have a problem with alignment of column content.
> By default, if a content of a column is too long 3 dots appears (e.g
HelloWorl...). I would lile to have such a behaviour on the left side of
column (e.g: ...elloWorld).
> Is there any possibility to do it ?
Powered by FUDForum
. Page generated in 0.01766 seconds