Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » NullReferenceException setting column width in grid
NullReferenceException setting column width in grid [message #1584156] Sun, 25 January 2015 15:57 Go to next message
Pete Davis is currently offline Pete DavisFriend
Messages: 8
Registered: January 2015
Junior Member
First, I'm pretty new to Eclipse and Nebula.

I just figured out the solution to my problem, but I'd like to understand why this should be happening, because to me, this seems like a bug:

I created a grid as follows:

	@Override
	protected Control createContents(Composite parent) {
		Composite container = new Composite(parent, SWT.NONE);
		
		Grid grid = new Grid(container, SWT.BORDER);
		grid.setHeaderVisible(true);
		grid.setBounds(10, 10, 414, 169);

		GridColumn col1 = new GridColumn(grid, SWT.NONE);
		col1.setText("Col1");
		col1.setWidth(100);
		GridColumn col2 = new GridColumn(grid, SWT.NONE);
		col2.setText("Col2");
		col2.setWidth(100);
		return container;
	}


This throws a NullReferenceException in the setWidth() call in Grid.handlePacked() because getHorizontalBar() returns null.

Of course the fix was to create my grid with scrollbars and looking over the examples, it looks like they all do that. But my question is, why? If the grid can't function properly without the SWT.V_SCROLLBAR | SWT.H_SCROLLBAR stuff being passed into the constructor, why aren't those styles just set by default?
Re: NullReferenceException setting column width in grid [message #1584169 is a reply to message #1584156] Sun, 25 January 2015 16:07 Go to previous messageGo to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 428
Registered: July 2009
Senior Member

Please file a bug for the exception. I doubt that it was intended to let the Grid not function properly without scrollbars.

Cheers,

Wim
Re: NullReferenceException setting column width in grid [message #1584218 is a reply to message #1584169] Sun, 25 January 2015 16:45 Go to previous messageGo to next message
Pete Davis is currently offline Pete DavisFriend
Messages: 8
Registered: January 2015
Junior Member
Done. Thanks.
Re: NullReferenceException setting column width in grid [message #1585453 is a reply to message #1584218] Mon, 26 January 2015 09:17 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 428
Registered: July 2009
Senior Member

https://bugs.eclipse.org/bugs/show_bug.cgi?id=458360
Previous Topic:Xviewer
Next Topic:Please delete this topic
Goto Forum:
  


Current Time: Tue Sep 18 21:03:26 GMT 2018

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

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

Back to the top