Skip to main content



      Home
Home » Eclipse Projects » Nebula » NullReferenceException setting column width in grid
NullReferenceException setting column width in grid [message #1584156] Sun, 25 January 2015 10:57 Go to next message
Eclipse UserFriend
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 11:07 Go to previous messageGo to next message
Eclipse UserFriend
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 11:45 Go to previous messageGo to next message
Eclipse UserFriend
Done. Thanks.
Re: NullReferenceException setting column width in grid [message #1585453 is a reply to message #1584218] Mon, 26 January 2015 04:17 Go to previous message
Eclipse UserFriend
https://bugs.eclipse.org/bugs/show_bug.cgi?id=458360
Previous Topic:Xviewer
Next Topic:Please delete this topic
Goto Forum:
  


Current Time: Wed Jun 18 17:48:58 EDT 2025

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

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

Back to the top