[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.technology.nebula] Re: select item in the gallery widget

Vicente Rico Guillén a écrit :

It doesn't work. I get a nullpointerexception..
-------------------------------------------------------------------------------


java.lang.NullPointerException
at org.eclipse.nebula.widgets.gallery.AbstractGridGroupRenderer.getVisibleItems(AbstractGridGroupRenderer.java:280)


at org.eclipse.nebula.widgets.gallery.NoGroupRenderer.draw(NoGroupRenderer.java:43)

at org.eclipse.nebula.widgets.gallery.Gallery._drawGroup(Gallery.java:1339)
at org.eclipse.nebula.widgets.gallery.Gallery.onPaint(Gallery.java:1183)
at org.eclipse.nebula.widgets.gallery.Gallery$2.paintControl(Gallery.java:586)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
--------------------------------------------------------------------------------



Please open a bug for this NPE



I show you the main code related to this:

------------------------------------------------
public void selectItemNumber(int number) { if (GlobalSettings.moviesList.size() > 0) {
moviesGallery.setFocus();
moviesGallery.setSelection( new GalleryItem[]{ moviesGallery.getItem( 0 ) } );

You get a NPE because you're trying to select a group, not an item

Replace by
moviesGallery.setSelection( new GalleryItem[]{ moviesGallery.getItem( 0 ).getItem(0) } );


It should work.

--

Nicolas