Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Table/Tree Item SWT.MeasureItem listener (Differences on the measureitem listener on windows and linux)
Table/Tree Item SWT.MeasureItem listener [message #641623] Fri, 26 November 2010 11:24 Go to next message
Stuart Ledwich is currently offline Stuart LedwichFriend
Messages: 10
Registered: November 2010
Junior Member
Currently when I add a MeasureItem listener to a SWT table or tree item I get a different result in windows and linux.

Currently linux appears to auto produce a treeitem that auto expands to the size of the content but on windows I get a consistent height of one line for the entire table.

If I then add a measureitem listener, again the effect is different. On windows I get ALL rows are resized to what appears to be the largest item. On linux it resizes exactly to the measurements given.

I have searched for this but cannot find any reason why this is happening.

Any help much appreciated.

Using SWT 3.5

Example of my listener to change the height:
		measureItemListener = new Listener() {
			public void handleEvent(Event event) {
				TreeItem item = (TreeItem)event.item;
				String text = item.getText(event.index);
				Point size = event.gc.textExtent(text);
				event.width = size.x + 2 * TEXT_MARGIN;
				event.height = size.y + TEXT_MARGIN;
Re: Table/Tree Item SWT.MeasureItem listener [message #641957 is a reply to message #641623] Mon, 29 November 2010 11:21 Go to previous message
Lakshmi P ShanmugamFriend
Messages: 277
Registered: July 2009
Location: India
Senior Member

Are you trying to set multiline text in to your TableItem using setText()? The multiples lines aren't shown because Windows doesn't support this. You can have a look at this snippet which uses paintListener to draw multiple lines in the table item --> Snippet231

Lakshmi P Shanmugam
Previous Topic:Tableviewer reset
Next Topic:How to trigger AccessibleEvent from unit test?
Goto Forum:

Current Time: Tue Jan 19 06:49:26 GMT 2021

Powered by FUDForum. Page generated in 0.02095 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top