Home » Eclipse Projects » Nebula » select item in the gallery widget
select item in the gallery widget [message #479120] |
Sun, 09 August 2009 14:46 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Hello!
I'm spanish developer and i'm including the gallery widget in my program.
The problem i have is that i don't know how can i select an item
programmatically.
I've added a selectionListener and when i click on a item , does right.
But now i fill the gallery with 40 photos, and i don't know how can i
tell to the program "select and highlight the last one, for example".
I've tried with setSelection, but can't do that.
In a SWT table, i use select(int itemNumber) and after
"notifyListener(SWT.Selection...)", but with the gallery widget i don't
know how to make it!!!.
Can you help me...???
And thanks for your help!!!
|
|
| |
Re: select item in the gallery widget [message #479128 is a reply to message #479126] |
Sun, 09 August 2009 16:37 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Nicolas Richeton escribió:
> Hi Vincente,
>
> #setSelection() does exactly what you want. What do you mean when you
> say "I've tried with setSelection, but can't do that." ?
>
> --
> Nicolas
>
> Vicente Rico Guillén a écrit :
>> Hello!
>> I'm spanish developer and i'm including the gallery widget in my program.
>> The problem i have is that i don't know how can i select an item
>> programmatically.
>> I've added a selectionListener and when i click on a item , does right.
>> But now i fill the gallery with 40 photos, and i don't know how can i
>> tell to the program "select and highlight the last one, for example".
>>
>> I've tried with setSelection, but can't do that.
>> In a SWT table, i use select(int itemNumber) and after
>> "notifyListener(SWT.Selection...)", but with the gallery widget i
>> don't know how to make it!!!.
>>
>> Can you help me...???
>>
>> And thanks for your help!!!
Well. I'll explain better... and thanks for answer :-D
My app has 3 view modes: 2 tables and 1 gallery.
I have a button that rotates between these 3 views.
When the user push a button, the program rotates between these views, as
i said before. The program fill the view perfectly, but when the
selected view is populated, i want to show the first elements (if not
empty). The order is "selectItem(int itemNumber);"
Then, the code for tables is this:
public void selectItemNumber(int item) {
if (GlobalSettings.moviesList.size() > 0) {
moviesTable.setFocus();
moviesTable.setSelection(item);
moviesTable.notifyListeners(SWT.Selection, new Event());
return;
} else {
return;
}
}
This works for the tables, but with the gallery don't.
I've tried the same for gallery but it's impossible.
|
|
| |
Re: select item in the gallery widget [message #479135 is a reply to message #479132] |
Sun, 09 August 2009 18:01 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Nicolas Richeton escribió:
> Vicente Rico Guillén a écrit :
>
>>
>> Well. I'll explain better... and thanks for answer :-D
>> My app has 3 view modes: 2 tables and 1 gallery.
>> I have a button that rotates between these 3 views.
>> When the user push a button, the program rotates between these views,
>> as i said before. The program fill the view perfectly, but when the
>> selected view is populated, i want to show the first elements (if not
>> empty). The order is "selectItem(int itemNumber);"
>>
>> Then, the code for tables is this:
>>
>>
>> public void selectItemNumber(int item) {
>> if (GlobalSettings.moviesList.size() > 0) {
>> moviesTable.setFocus();
>> moviesTable.setSelection(item);
>> moviesTable.notifyListeners(SWT.Selection, new Event());
>> return;
>> } else {
>> return;
>> }
>> }
>>
>>
>>
>> This works for the tables, but with the gallery don't.
>> I've tried the same for gallery but it's impossible.
>
> setSelection( int index) does not exist in the gallery yet, please open
> a bug if you need it.
>
> But you'll get the same result using :
>
>
> Keep in mind that Gallery is a Tree and groups are root items. So you
> need to call getItem() on the parent group of your item.
>
Excuse me, but it doesn't work. You said that with:
setSelection( galleryGroup.getItem( index ) )
i'll get the same result but:
In javadoc, says that the method setSelection needs a GalleryItem[]. I
mean, it needs an array of items. With your code, "getItem" returns only
an item, and Eclipse show error because this method expect an array of
GalleryItems and not only an item.
What i want to do is that, select ONLY an item: the first item.
In short:
I want select, programmatically the first item of a gallery after this
gallery is populated. I want this item selected, and painted in the
gallery as selected. In the other hand, setSelection only accept as
argument an array of galleryItems and not only a galleryItem.
How can this be done?? Have you any idea? Thanks!!!
|
|
|
Re: select item in the gallery widget [message #479137 is a reply to message #479135] |
Sun, 09 August 2009 18:05 |
Nicolas Richeton Messages: 179 Registered: July 2009 |
Senior Member |
|
|
Vicente Rico Guillén a écrit :
> Nicolas Richeton escribió:
>> Vicente Rico Guillén a écrit :
>>
>>>
>>> Well. I'll explain better... and thanks for answer :-D
>>> My app has 3 view modes: 2 tables and 1 gallery.
>>> I have a button that rotates between these 3 views.
>>> When the user push a button, the program rotates between these views,
>>> as i said before. The program fill the view perfectly, but when the
>>> selected view is populated, i want to show the first elements (if not
>>> empty). The order is "selectItem(int itemNumber);"
>>>
>>> Then, the code for tables is this:
>>>
>>>
>>> public void selectItemNumber(int item) {
>>> if (GlobalSettings.moviesList.size() > 0) {
>>> moviesTable.setFocus();
>>> moviesTable.setSelection(item);
>>> moviesTable.notifyListeners(SWT.Selection, new Event());
>>> return;
>>> } else {
>>> return;
>>> }
>>> }
>>>
>>>
>>>
>>> This works for the tables, but with the gallery don't.
>>> I've tried the same for gallery but it's impossible.
>>
>> setSelection( int index) does not exist in the gallery yet, please
>> open a bug if you need it.
>>
>> But you'll get the same result using :
>>
>
>>
>> Keep in mind that Gallery is a Tree and groups are root items. So you
>> need to call getItem() on the parent group of your item.
>>
>
>
>
> Excuse me, but it doesn't work. You said that with:
> setSelection( galleryGroup.getItem( index ) )
> i'll get the same result but:
> In javadoc, says that the method setSelection needs a GalleryItem[]. I
> mean, it needs an array of items. With your code, "getItem" returns only
> an item, and Eclipse show error because this method expect an array of
> GalleryItems and not only an item.
> What i want to do is that, select ONLY an item: the first item.
>
> In short:
> I want select, programmatically the first item of a gallery after this
> gallery is populated. I want this item selected, and painted in the
> gallery as selected. In the other hand, setSelection only accept as
> argument an array of galleryItems and not only a galleryItem.
> How can this be done?? Have you any idea? Thanks!!!
What about creating an array ? ;-)
setSelection( new GalleryItem[]{ galleryGroup.getItem( index ) } );
--
Nicolas
|
|
|
Re: select item in the gallery widget [message #479138 is a reply to message #479137] |
Sun, 09 August 2009 18:16 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Nicolas Richeton escribió:
> Vicente Rico Guillén a écrit :
>> Nicolas Richeton escribió:
>>> Vicente Rico Guillén a écrit :
>>>
>>>>
>>>> Well. I'll explain better... and thanks for answer :-D
>>>> My app has 3 view modes: 2 tables and 1 gallery.
>>>> I have a button that rotates between these 3 views.
>>>> When the user push a button, the program rotates between these
>>>> views, as i said before. The program fill the view perfectly, but
>>>> when the selected view is populated, i want to show the first
>>>> elements (if not empty). The order is "selectItem(int itemNumber);"
>>>>
>>>> Then, the code for tables is this:
>>>>
>>>>
>>>> public void selectItemNumber(int item) {
>>>> if (GlobalSettings.moviesList.size() > 0) {
>>>> moviesTable.setFocus();
>>>> moviesTable.setSelection(item);
>>>> moviesTable.notifyListeners(SWT.Selection, new Event());
>>>> return;
>>>> } else {
>>>> return;
>>>> }
>>>> }
>>>>
>>>>
>>>>
>>>> This works for the tables, but with the gallery don't.
>>>> I've tried the same for gallery but it's impossible.
>>>
>>> setSelection( int index) does not exist in the gallery yet, please
>>> open a bug if you need it.
>>>
>>> But you'll get the same result using :
>>>
>>
>>>
>>> Keep in mind that Gallery is a Tree and groups are root items. So you
>>> need to call getItem() on the parent group of your item.
>>>
>>
>>
>>
>> Excuse me, but it doesn't work. You said that with:
>> setSelection( galleryGroup.getItem( index ) )
>> i'll get the same result but:
>> In javadoc, says that the method setSelection needs a GalleryItem[]. I
>> mean, it needs an array of items. With your code, "getItem" returns
>> only an item, and Eclipse show error because this method expect an
>> array of GalleryItems and not only an item.
>> What i want to do is that, select ONLY an item: the first item.
>>
>> In short:
>> I want select, programmatically the first item of a gallery after this
>> gallery is populated. I want this item selected, and painted in the
>> gallery as selected. In the other hand, setSelection only accept as
>> argument an array of galleryItems and not only a galleryItem.
>> How can this be done?? Have you any idea? Thanks!!!
>
> What about creating an array ? ;-)
>
> setSelection( new GalleryItem[]{ galleryGroup.getItem( index ) } );
>
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(NoGr oupRenderer.java:43)
at org.eclipse.nebula.widgets.gallery.Gallery._drawGroup(Galler y.java:1339)
at org.eclipse.nebula.widgets.gallery.Gallery.onPaint(Gallery.j ava:1183)
at
org.eclipse.nebula.widgets.gallery.Gallery$2.paintControl(Ga llery.java:586)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
------------------------------------------------------------ --------------------
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 ) } );
moviesGallery.notifyListeners(SWT.Selection, new Event());
return;
} else {
return;
}
}
-------------------------------------------------
moviesGallery.addListener(SWT.SetData, new Listener() {
public void handleEvent(Event event) {
if (GlobalSettings.moviesList.size()==0) return;
GalleryItem item = (GalleryItem) event.item;
int index;
index = moviesGallery.indexOf(item);
Long movieID= GlobalSettings.moviesList.get(index);
String caratula = getCover(index);
if (StringUtils.isBlank(caratula)) {
caratula = "noCover.jpg";
}
item.setImage(new Image(GUI.display,baseDirForImages+caratula));
listaImagenes.add(item.getImage());
item.setData(movieID);
item.setItemCount(GlobalSettings.moviesList.size());
}
});
------------------------------------------------------------ --------------
Globalsettings.movieslist is a LinkedList with movies Objects. And yes,
i'm developing a movie manager: www.visualdivx.org :-D
------------------------------------------------------------ -------------------
moviesGallery.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
if (getSelectedMovies().size() == 0)
return;
Long alfa = (Long) getSelectedMovies().get(0);
long number = alfa.longValue();
gui.getDataBase().loadMovieObjectIntoMemory(number);
if (secundaryControl!=null) {
secundaryControl.fillData();
// IN SECUNDARYCONTROL.FILLDATA i fill a Browser control.
}else{
}
}
});
|
|
| |
Re: select item in the gallery widget [message #479145 is a reply to message #479142] |
Sun, 09 August 2009 19:43 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Nicolas Richeton escribió:
> 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(NoGr oupRenderer.java:43)
>>
>> at
>> org.eclipse.nebula.widgets.gallery.Gallery._drawGroup(Galler y.java:1339)
>> at
>> org.eclipse.nebula.widgets.gallery.Gallery.onPaint(Gallery.j ava:1183)
>> at
>> org.eclipse.nebula.widgets.gallery.Gallery$2.paintControl(Ga llery.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.
>
No, once more, it doesn't work. I'm sorry for make to you spend the time
with me. For me it's important, because all in my app works fine except
this problem.
The error :
java.lang.NullPointerException
at
org.eclipse.nebula.widgets.gallery.AbstractGridGroupRenderer .getVisibleItems(AbstractGridGroupRenderer.java:280)
at
org.eclipse.nebula.widgets.gallery.NoGroupRenderer.draw(NoGr oupRenderer.java:43)
at org.eclipse.nebula.widgets.gallery.Gallery._drawGroup(Galler y.java:1339)
at org.eclipse.nebula.widgets.gallery.Gallery.onPaint(Gallery.j ava:1183)
at
org.eclipse.nebula.widgets.gallery.Gallery$2.paintControl(Ga llery.java:586)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
------------------------------------
I post all the class if case can catch another problem in another place
in the code.
package org.VisualDivX.Components;
import java.util.LinkedList;
import java.util.TreeMap;
import java.util.Vector;
import org.VisualDivX.GUI;
import org.VisualDivX.GlobalSettings;
import org.apache.commons.lang.StringUtils;
import org.eclipse.nebula.widgets.gallery.DefaultGalleryItemRendere r;
import org.eclipse.nebula.widgets.gallery.Gallery;
import org.eclipse.nebula.widgets.gallery.GalleryItem;
import org.eclipse.nebula.widgets.gallery.NoGroupRenderer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
public class MoviesListCovers {
private Composite composite;
public static Gallery moviesGallery;
final Font font3 = new Font(GUI.display, "Arial", 7, SWT.NORMAL);
private GUI gui;
private TreeMap<String, Image> imgCache;
private String baseDirForImages;
private NoGroupRenderer gr;
private LinkedList<Image> listaImagenes;
private MovieCardComponent secundaryControl;
public MoviesListCovers(GUI gui, Composite composite,
MovieCardComponent secundaryControl) {
this.gui = gui;
this.composite = composite;
this.secundaryControl=secundaryControl;
listaImagenes=new LinkedList<Image>();
}
public void init() {
createMoviesGallery();
initListeners();
refresh();
}
public void dispose(){
for (int a=0;a<listaImagenes.size();a++){
listaImagenes.get(a).dispose();
}
}
private void createMoviesGallery() {
moviesGallery = new Gallery(composite, SWT.V_SCROLL | SWT.BORDER
| SWT.VIRTUAL);
//moviesGallery.setBackground(GUI.display.getSystemColor(SWT .COLOR_BLACK));
gr = new NoGroupRenderer();
gr.setItemSize(90,120);
// gr.setItemSize(140, 170);
gr.setMinMargin(0);
DefaultGalleryItemRenderer ir = new DefaultGalleryItemRenderer();
// ir.setDropShadows(true);
// ir.setDropShadowsSize(5);
moviesGallery.setGroupRenderer(gr);
moviesGallery.setItemRenderer(ir);
moviesGallery.setVirtualGroups(true);
moviesGallery.setLayoutData(new GridData(GridData.FILL_BOTH));
moviesGallery.setFont(font3);
switch (GlobalSettings.qualityCoversWanted) {
case LOW:
moviesGallery.setAntialias(SWT.OFF);
moviesGallery.setInterpolation(SWT.OFF);
baseDirForImages = GlobalSettings.DATABASE_IN_USE_MINI_IMAGES_DIR
+ GlobalSettings.PATH_SEPARATOR;
break;
case MEDIUM:
//moviesGallery.setAntialias(SWT.ON);
//moviesGallery.setInterpolation(SWT.ON);
baseDirForImages = GlobalSettings.DATABASE_IN_USE_MINI_IMAGES_DIR
+ GlobalSettings.PATH_SEPARATOR;
break;
case HIGH:
baseDirForImages = GlobalSettings.DATABASE_IN_USE_IMAGES_DIR
+ GlobalSettings.PATH_SEPARATOR;
break;
}
moviesGallery.setLowQualityOnUserAction(true);
}
public void initListeners() {
moviesGallery.addListener(SWT.SetData, new Listener() {
public void handleEvent(Event event) {
if (GlobalSettings.moviesList.size()==0) return;
GalleryItem item = (GalleryItem) event.item;
int index;
index = moviesGallery.indexOf(item);
Long movieID= GlobalSettings.moviesList.get(index);
String caratula = getCover(index);
if (StringUtils.isBlank(caratula)) {
caratula = "noCover.jpg";
}
//item.setImage(ImageManager.getImageFromFile(baseDirForImag es +
caratula));
item.setImage(new Image(GUI.display,baseDirForImages+caratula));
listaImagenes.add(item.getImage());
item.setData(movieID);
item.setItemCount(GlobalSettings.moviesList.size());
}
});
/*moviesGallery.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
int alfa = moviesGallery.getClientArea().width;
int beta = moviesGallery.getClientArea().height;
gr.setItemSize(alfa
/ GlobalSettings.listViewCovers_Horizontal_Covers, beta
/ GlobalSettings.listViewCovers_Vertical_Covers);
}
});*/
moviesGallery.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
Menu menu = gui.getPopUpMenu().init();
menu.setLocation(event.x, event.y);
menu.setVisible(true);
while (!menu.isDisposed() && menu.isVisible()) {
if (!GUI.display.readAndDispatch())
GUI.display.sleep();
}
menu.dispose();
}
});
moviesGallery.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
if (getSelectedMovies().size() == 0)
return;
Long alfa = (Long) getSelectedMovies().get(0);
long number = alfa.longValue();
gui.getDataBase().loadMovieObjectIntoMemory(number);
if (secundaryControl!=null) {
secundaryControl.fillData();
}else{
}
}
});
/*moviesGallery.addListener(SWT.PaintItem, new Listener() {
public void handleEvent(Event e) {
GalleryItem item = (GalleryItem) e.item;
Long data=(Long) item.getData();
String alfa = gui.getDataBase().getMovieObjectByIndex(data).getCover();
e.gc.setBackground(GUI.display.getSystemColor(
SWT.COLOR_GRAY));
e.gc.fillRectangle(e.x, e.y, e.width, e.height);
Image imagen=new Image(GUI.display,baseDirForImages+alfa);
e.gc.drawImage(imagen,e.x,e.y);
imagen.dispose();
}
});*/
}
public Vector<Long> getSelectedMovies() {
Vector<Long> items = new Vector<Long>();
GalleryItem[] selection = moviesGallery.getSelection();
for (int i = 0; i < selection.length; i++) {
if (selection[i].getData() != null)
items.add((Long) selection[i].getData());
selection[i].getText();
}
return items;
}
private String getCover(int index) {
long id = GlobalSettings.moviesList.get(index);
String alfa = gui.getDataBase().getMovieObjectByIndex(id).getCover();
if (StringUtils.isBlank(alfa)) alfa="noCover.jpg";
return alfa;
}
public Image getImageInCache(String image) {
if (imgCache == null)
return null;
if (imgCache.containsKey(image)) {
return imgCache.get(image);
} else {
return null;
}
}
public void refresh() {
GalleryItem[] items = moviesGallery.getItems();
for(int i=0; items != null && i < items.length; i++) {
if(items[i].getImage() != null)
items[i].getImage().dispose();
}
moviesGallery.clearAll();
moviesGallery.setItemCount(1);
}
public Gallery getMoviesGallery() {
return moviesGallery;
}
public void selectItemNumber(int number) {
if (GlobalSettings.moviesList.size() > 0) {
moviesGallery.setFocus();
moviesGallery.setSelection( new GalleryItem[]{
moviesGallery.getItem(0).getItem(0) } );
moviesGallery.notifyListeners(SWT.Selection, new Event());
return;
} else {
return;
}
}
}
|
|
|
Re: select item in the gallery widget [message #479146 is a reply to message #479142] |
Sun, 09 August 2009 19:48 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Nicolas Richeton escribió:
> 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(NoGr oupRenderer.java:43)
>>
>> at
>> org.eclipse.nebula.widgets.gallery.Gallery._drawGroup(Galler y.java:1339)
>> at
>> org.eclipse.nebula.widgets.gallery.Gallery.onPaint(Gallery.j ava:1183)
>> at
>> org.eclipse.nebula.widgets.gallery.Gallery$2.paintControl(Ga llery.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.
>
I forget to say: I don't declare any group in the gallery. Maybe is
there the problem, i don't know.
|
|
| |
Re: select item in the gallery widget [message #479271 is a reply to message #479227] |
Mon, 10 August 2009 13:51 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Nicolas Richeton escribió:
>
> You uses moviesGallery.setItemCount(1); This creates one group (group
> are root level items, you'll see the group with the default group
> renderer).
> - Please test your code with both the latest stable release and the
> latest nightly build. (http://www.eclipse.org/nebula/downloads.php)
>
> - Try to remove moviesGallery.setVirtualGroups(true); . This method
> improves init time when a lot of groups are used ( 50+). It is totally
> useless in your case and since this is a quite new feature, it may be
> the issue.
>
> - Your setData handler should test if the item is a group or an item.
> (getParentItem() == null for groups). You are setting item count > 0 for
> every item. This currenlty works because renderers only paint 2 levels
> of items, but will create an infinite loop in the future.
>
> - If this does not solve your problem, open a bug and attach a Junit
> test case or a snippet showing the bug (see
> http://www.eclipse.org/swt/snippets/ for sample snippets).
>
Thanks!!!. When i removed "moviesGallery.setVirtualGroups(true), i've
executed the app, and it works!!! Now selects fine the first element.
The apps works with: moviesGallery.setSelection( new GalleryItem[]{
moviesGallery.getItem(0).getItem(number) } );
and now, i'm able to select programmatically every number i want. I
suppose the order is: moviesgallery.getItem(group).getItem(number of a
item in this group). Is this right?
|
|
| |
Re: select item in the gallery widget [message #595903 is a reply to message #479126] |
Sun, 09 August 2009 16:37 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Nicolas Richeton escribió:
> Hi Vincente,
>
> #setSelection() does exactly what you want. What do you mean when you
> say "I've tried with setSelection, but can't do that." ?
>
> --
> Nicolas
>
> Vicente Rico Guillén a écrit :
>> Hello!
>> I'm spanish developer and i'm including the gallery widget in my program.
>> The problem i have is that i don't know how can i select an item
>> programmatically.
>> I've added a selectionListener and when i click on a item , does right.
>> But now i fill the gallery with 40 photos, and i don't know how can i
>> tell to the program "select and highlight the last one, for example".
>>
>> I've tried with setSelection, but can't do that.
>> In a SWT table, i use select(int itemNumber) and after
>> "notifyListener(SWT.Selection...)", but with the gallery widget i
>> don't know how to make it!!!.
>>
>> Can you help me...???
>>
>> And thanks for your help!!!
Well. I'll explain better... and thanks for answer :-D
My app has 3 view modes: 2 tables and 1 gallery.
I have a button that rotates between these 3 views.
When the user push a button, the program rotates between these views, as
i said before. The program fill the view perfectly, but when the
selected view is populated, i want to show the first elements (if not
empty). The order is "selectItem(int itemNumber);"
Then, the code for tables is this:
public void selectItemNumber(int item) {
if (GlobalSettings.moviesList.size() > 0) {
moviesTable.setFocus();
moviesTable.setSelection(item);
moviesTable.notifyListeners(SWT.Selection, new Event());
return;
} else {
return;
}
}
This works for the tables, but with the gallery don't.
I've tried the same for gallery but it's impossible.
|
|
| |
Re: select item in the gallery widget [message #595922 is a reply to message #479132] |
Sun, 09 August 2009 18:01 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Nicolas Richeton escribió:
> Vicente Rico Guillén a écrit :
>
>>
>> Well. I'll explain better... and thanks for answer :-D
>> My app has 3 view modes: 2 tables and 1 gallery.
>> I have a button that rotates between these 3 views.
>> When the user push a button, the program rotates between these views,
>> as i said before. The program fill the view perfectly, but when the
>> selected view is populated, i want to show the first elements (if not
>> empty). The order is "selectItem(int itemNumber);"
>>
>> Then, the code for tables is this:
>>
>>
>> public void selectItemNumber(int item) {
>> if (GlobalSettings.moviesList.size() > 0) {
>> moviesTable.setFocus();
>> moviesTable.setSelection(item);
>> moviesTable.notifyListeners(SWT.Selection, new Event());
>> return;
>> } else {
>> return;
>> }
>> }
>>
>>
>>
>> This works for the tables, but with the gallery don't.
>> I've tried the same for gallery but it's impossible.
>
> setSelection( int index) does not exist in the gallery yet, please open
> a bug if you need it.
>
> But you'll get the same result using :
>
>
> Keep in mind that Gallery is a Tree and groups are root items. So you
> need to call getItem() on the parent group of your item.
>
Excuse me, but it doesn't work. You said that with:
setSelection( galleryGroup.getItem( index ) )
i'll get the same result but:
In javadoc, says that the method setSelection needs a GalleryItem[]. I
mean, it needs an array of items. With your code, "getItem" returns only
an item, and Eclipse show error because this method expect an array of
GalleryItems and not only an item.
What i want to do is that, select ONLY an item: the first item.
In short:
I want select, programmatically the first item of a gallery after this
gallery is populated. I want this item selected, and painted in the
gallery as selected. In the other hand, setSelection only accept as
argument an array of galleryItems and not only a galleryItem.
How can this be done?? Have you any idea? Thanks!!!
|
|
|
Re: select item in the gallery widget [message #598067 is a reply to message #479135] |
Sun, 09 August 2009 18:05 |
Nicolas Richeton Messages: 179 Registered: July 2009 |
Senior Member |
|
|
Vicente Rico Guillén a écrit :
> Nicolas Richeton escribió:
>> Vicente Rico Guillén a écrit :
>>
>>>
>>> Well. I'll explain better... and thanks for answer :-D
>>> My app has 3 view modes: 2 tables and 1 gallery.
>>> I have a button that rotates between these 3 views.
>>> When the user push a button, the program rotates between these views,
>>> as i said before. The program fill the view perfectly, but when the
>>> selected view is populated, i want to show the first elements (if not
>>> empty). The order is "selectItem(int itemNumber);"
>>>
>>> Then, the code for tables is this:
>>>
>>>
>>> public void selectItemNumber(int item) {
>>> if (GlobalSettings.moviesList.size() > 0) {
>>> moviesTable.setFocus();
>>> moviesTable.setSelection(item);
>>> moviesTable.notifyListeners(SWT.Selection, new Event());
>>> return;
>>> } else {
>>> return;
>>> }
>>> }
>>>
>>>
>>>
>>> This works for the tables, but with the gallery don't.
>>> I've tried the same for gallery but it's impossible.
>>
>> setSelection( int index) does not exist in the gallery yet, please
>> open a bug if you need it.
>>
>> But you'll get the same result using :
>>
>
>>
>> Keep in mind that Gallery is a Tree and groups are root items. So you
>> need to call getItem() on the parent group of your item.
>>
>
>
>
> Excuse me, but it doesn't work. You said that with:
> setSelection( galleryGroup.getItem( index ) )
> i'll get the same result but:
> In javadoc, says that the method setSelection needs a GalleryItem[]. I
> mean, it needs an array of items. With your code, "getItem" returns only
> an item, and Eclipse show error because this method expect an array of
> GalleryItems and not only an item.
> What i want to do is that, select ONLY an item: the first item.
>
> In short:
> I want select, programmatically the first item of a gallery after this
> gallery is populated. I want this item selected, and painted in the
> gallery as selected. In the other hand, setSelection only accept as
> argument an array of galleryItems and not only a galleryItem.
> How can this be done?? Have you any idea? Thanks!!!
What about creating an array ? ;-)
setSelection( new GalleryItem[]{ galleryGroup.getItem( index ) } );
--
Nicolas
|
|
|
Re: select item in the gallery widget [message #598076 is a reply to message #479137] |
Sun, 09 August 2009 18:16 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Nicolas Richeton escribió:
> Vicente Rico Guillén a écrit :
>> Nicolas Richeton escribió:
>>> Vicente Rico Guillén a écrit :
>>>
>>>>
>>>> Well. I'll explain better... and thanks for answer :-D
>>>> My app has 3 view modes: 2 tables and 1 gallery.
>>>> I have a button that rotates between these 3 views.
>>>> When the user push a button, the program rotates between these
>>>> views, as i said before. The program fill the view perfectly, but
>>>> when the selected view is populated, i want to show the first
>>>> elements (if not empty). The order is "selectItem(int itemNumber);"
>>>>
>>>> Then, the code for tables is this:
>>>>
>>>>
>>>> public void selectItemNumber(int item) {
>>>> if (GlobalSettings.moviesList.size() > 0) {
>>>> moviesTable.setFocus();
>>>> moviesTable.setSelection(item);
>>>> moviesTable.notifyListeners(SWT.Selection, new Event());
>>>> return;
>>>> } else {
>>>> return;
>>>> }
>>>> }
>>>>
>>>>
>>>>
>>>> This works for the tables, but with the gallery don't.
>>>> I've tried the same for gallery but it's impossible.
>>>
>>> setSelection( int index) does not exist in the gallery yet, please
>>> open a bug if you need it.
>>>
>>> But you'll get the same result using :
>>>
>>
>>>
>>> Keep in mind that Gallery is a Tree and groups are root items. So you
>>> need to call getItem() on the parent group of your item.
>>>
>>
>>
>>
>> Excuse me, but it doesn't work. You said that with:
>> setSelection( galleryGroup.getItem( index ) )
>> i'll get the same result but:
>> In javadoc, says that the method setSelection needs a GalleryItem[]. I
>> mean, it needs an array of items. With your code, "getItem" returns
>> only an item, and Eclipse show error because this method expect an
>> array of GalleryItems and not only an item.
>> What i want to do is that, select ONLY an item: the first item.
>>
>> In short:
>> I want select, programmatically the first item of a gallery after this
>> gallery is populated. I want this item selected, and painted in the
>> gallery as selected. In the other hand, setSelection only accept as
>> argument an array of galleryItems and not only a galleryItem.
>> How can this be done?? Have you any idea? Thanks!!!
>
> What about creating an array ? ;-)
>
> setSelection( new GalleryItem[]{ galleryGroup.getItem( index ) } );
>
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(NoGr oupRenderer.java:43)
at org.eclipse.nebula.widgets.gallery.Gallery._drawGroup(Galler y.java:1339)
at org.eclipse.nebula.widgets.gallery.Gallery.onPaint(Gallery.j ava:1183)
at
org.eclipse.nebula.widgets.gallery.Gallery$2.paintControl(Ga llery.java:586)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
------------------------------------------------------------ --------------------
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 ) } );
moviesGallery.notifyListeners(SWT.Selection, new Event());
return;
} else {
return;
}
}
-------------------------------------------------
moviesGallery.addListener(SWT.SetData, new Listener() {
public void handleEvent(Event event) {
if (GlobalSettings.moviesList.size()==0) return;
GalleryItem item = (GalleryItem) event.item;
int index;
index = moviesGallery.indexOf(item);
Long movieID= GlobalSettings.moviesList.get(index);
String caratula = getCover(index);
if (StringUtils.isBlank(caratula)) {
caratula = "noCover.jpg";
}
item.setImage(new Image(GUI.display,baseDirForImages+caratula));
listaImagenes.add(item.getImage());
item.setData(movieID);
item.setItemCount(GlobalSettings.moviesList.size());
}
});
------------------------------------------------------------ --------------
Globalsettings.movieslist is a LinkedList with movies Objects. And yes,
i'm developing a movie manager: www.visualdivx.org :-D
------------------------------------------------------------ -------------------
moviesGallery.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
if (getSelectedMovies().size() == 0)
return;
Long alfa = (Long) getSelectedMovies().get(0);
long number = alfa.longValue();
gui.getDataBase().loadMovieObjectIntoMemory(number);
if (secundaryControl!=null) {
secundaryControl.fillData();
// IN SECUNDARYCONTROL.FILLDATA i fill a Browser control.
}else{
}
}
});
|
|
| |
Re: select item in the gallery widget [message #598083 is a reply to message #479142] |
Sun, 09 August 2009 19:43 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Nicolas Richeton escribió:
> 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(NoGr oupRenderer.java:43)
>>
>> at
>> org.eclipse.nebula.widgets.gallery.Gallery._drawGroup(Galler y.java:1339)
>> at
>> org.eclipse.nebula.widgets.gallery.Gallery.onPaint(Gallery.j ava:1183)
>> at
>> org.eclipse.nebula.widgets.gallery.Gallery$2.paintControl(Ga llery.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.
>
No, once more, it doesn't work. I'm sorry for make to you spend the time
with me. For me it's important, because all in my app works fine except
this problem.
The error :
java.lang.NullPointerException
at
org.eclipse.nebula.widgets.gallery.AbstractGridGroupRenderer .getVisibleItems(AbstractGridGroupRenderer.java:280)
at
org.eclipse.nebula.widgets.gallery.NoGroupRenderer.draw(NoGr oupRenderer.java:43)
at org.eclipse.nebula.widgets.gallery.Gallery._drawGroup(Galler y.java:1339)
at org.eclipse.nebula.widgets.gallery.Gallery.onPaint(Gallery.j ava:1183)
at
org.eclipse.nebula.widgets.gallery.Gallery$2.paintControl(Ga llery.java:586)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
------------------------------------
I post all the class if case can catch another problem in another place
in the code.
package org.VisualDivX.Components;
import java.util.LinkedList;
import java.util.TreeMap;
import java.util.Vector;
import org.VisualDivX.GUI;
import org.VisualDivX.GlobalSettings;
import org.apache.commons.lang.StringUtils;
import org.eclipse.nebula.widgets.gallery.DefaultGalleryItemRendere r;
import org.eclipse.nebula.widgets.gallery.Gallery;
import org.eclipse.nebula.widgets.gallery.GalleryItem;
import org.eclipse.nebula.widgets.gallery.NoGroupRenderer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
public class MoviesListCovers {
private Composite composite;
public static Gallery moviesGallery;
final Font font3 = new Font(GUI.display, "Arial", 7, SWT.NORMAL);
private GUI gui;
private TreeMap<String, Image> imgCache;
private String baseDirForImages;
private NoGroupRenderer gr;
private LinkedList<Image> listaImagenes;
private MovieCardComponent secundaryControl;
public MoviesListCovers(GUI gui, Composite composite,
MovieCardComponent secundaryControl) {
this.gui = gui;
this.composite = composite;
this.secundaryControl=secundaryControl;
listaImagenes=new LinkedList<Image>();
}
public void init() {
createMoviesGallery();
initListeners();
refresh();
}
public void dispose(){
for (int a=0;a<listaImagenes.size();a++){
listaImagenes.get(a).dispose();
}
}
private void createMoviesGallery() {
moviesGallery = new Gallery(composite, SWT.V_SCROLL | SWT.BORDER
| SWT.VIRTUAL);
//moviesGallery.setBackground(GUI.display.getSystemColor(SWT .COLOR_BLACK));
gr = new NoGroupRenderer();
gr.setItemSize(90,120);
// gr.setItemSize(140, 170);
gr.setMinMargin(0);
DefaultGalleryItemRenderer ir = new DefaultGalleryItemRenderer();
// ir.setDropShadows(true);
// ir.setDropShadowsSize(5);
moviesGallery.setGroupRenderer(gr);
moviesGallery.setItemRenderer(ir);
moviesGallery.setVirtualGroups(true);
moviesGallery.setLayoutData(new GridData(GridData.FILL_BOTH));
moviesGallery.setFont(font3);
switch (GlobalSettings.qualityCoversWanted) {
case LOW:
moviesGallery.setAntialias(SWT.OFF);
moviesGallery.setInterpolation(SWT.OFF);
baseDirForImages = GlobalSettings.DATABASE_IN_USE_MINI_IMAGES_DIR
+ GlobalSettings.PATH_SEPARATOR;
break;
case MEDIUM:
//moviesGallery.setAntialias(SWT.ON);
//moviesGallery.setInterpolation(SWT.ON);
baseDirForImages = GlobalSettings.DATABASE_IN_USE_MINI_IMAGES_DIR
+ GlobalSettings.PATH_SEPARATOR;
break;
case HIGH:
baseDirForImages = GlobalSettings.DATABASE_IN_USE_IMAGES_DIR
+ GlobalSettings.PATH_SEPARATOR;
break;
}
moviesGallery.setLowQualityOnUserAction(true);
}
public void initListeners() {
moviesGallery.addListener(SWT.SetData, new Listener() {
public void handleEvent(Event event) {
if (GlobalSettings.moviesList.size()==0) return;
GalleryItem item = (GalleryItem) event.item;
int index;
index = moviesGallery.indexOf(item);
Long movieID= GlobalSettings.moviesList.get(index);
String caratula = getCover(index);
if (StringUtils.isBlank(caratula)) {
caratula = "noCover.jpg";
}
//item.setImage(ImageManager.getImageFromFile(baseDirForImag es +
caratula));
item.setImage(new Image(GUI.display,baseDirForImages+caratula));
listaImagenes.add(item.getImage());
item.setData(movieID);
item.setItemCount(GlobalSettings.moviesList.size());
}
});
/*moviesGallery.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
int alfa = moviesGallery.getClientArea().width;
int beta = moviesGallery.getClientArea().height;
gr.setItemSize(alfa
/ GlobalSettings.listViewCovers_Horizontal_Covers, beta
/ GlobalSettings.listViewCovers_Vertical_Covers);
}
});*/
moviesGallery.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
Menu menu = gui.getPopUpMenu().init();
menu.setLocation(event.x, event.y);
menu.setVisible(true);
while (!menu.isDisposed() && menu.isVisible()) {
if (!GUI.display.readAndDispatch())
GUI.display.sleep();
}
menu.dispose();
}
});
moviesGallery.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
if (getSelectedMovies().size() == 0)
return;
Long alfa = (Long) getSelectedMovies().get(0);
long number = alfa.longValue();
gui.getDataBase().loadMovieObjectIntoMemory(number);
if (secundaryControl!=null) {
secundaryControl.fillData();
}else{
}
}
});
/*moviesGallery.addListener(SWT.PaintItem, new Listener() {
public void handleEvent(Event e) {
GalleryItem item = (GalleryItem) e.item;
Long data=(Long) item.getData();
String alfa = gui.getDataBase().getMovieObjectByIndex(data).getCover();
e.gc.setBackground(GUI.display.getSystemColor(
SWT.COLOR_GRAY));
e.gc.fillRectangle(e.x, e.y, e.width, e.height);
Image imagen=new Image(GUI.display,baseDirForImages+alfa);
e.gc.drawImage(imagen,e.x,e.y);
imagen.dispose();
}
});*/
}
public Vector<Long> getSelectedMovies() {
Vector<Long> items = new Vector<Long>();
GalleryItem[] selection = moviesGallery.getSelection();
for (int i = 0; i < selection.length; i++) {
if (selection[i].getData() != null)
items.add((Long) selection[i].getData());
selection[i].getText();
}
return items;
}
private String getCover(int index) {
long id = GlobalSettings.moviesList.get(index);
String alfa = gui.getDataBase().getMovieObjectByIndex(id).getCover();
if (StringUtils.isBlank(alfa)) alfa="noCover.jpg";
return alfa;
}
public Image getImageInCache(String image) {
if (imgCache == null)
return null;
if (imgCache.containsKey(image)) {
return imgCache.get(image);
} else {
return null;
}
}
public void refresh() {
GalleryItem[] items = moviesGallery.getItems();
for(int i=0; items != null && i < items.length; i++) {
if(items[i].getImage() != null)
items[i].getImage().dispose();
}
moviesGallery.clearAll();
moviesGallery.setItemCount(1);
}
public Gallery getMoviesGallery() {
return moviesGallery;
}
public void selectItemNumber(int number) {
if (GlobalSettings.moviesList.size() > 0) {
moviesGallery.setFocus();
moviesGallery.setSelection( new GalleryItem[]{
moviesGallery.getItem(0).getItem(0) } );
moviesGallery.notifyListeners(SWT.Selection, new Event());
return;
} else {
return;
}
}
}
|
|
|
Re: select item in the gallery widget [message #598088 is a reply to message #479142] |
Sun, 09 August 2009 19:48 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Nicolas Richeton escribió:
> 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(NoGr oupRenderer.java:43)
>>
>> at
>> org.eclipse.nebula.widgets.gallery.Gallery._drawGroup(Galler y.java:1339)
>> at
>> org.eclipse.nebula.widgets.gallery.Gallery.onPaint(Gallery.j ava:1183)
>> at
>> org.eclipse.nebula.widgets.gallery.Gallery$2.paintControl(Ga llery.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.
>
I forget to say: I don't declare any group in the gallery. Maybe is
there the problem, i don't know.
|
|
| |
Re: select item in the gallery widget [message #598103 is a reply to message #598097] |
Mon, 10 August 2009 13:51 |
Eclipse User |
|
|
|
Originally posted by: vicenterg.arrakis.es
Nicolas Richeton escribió:
>
> You uses moviesGallery.setItemCount(1); This creates one group (group
> are root level items, you'll see the group with the default group
> renderer).
> - Please test your code with both the latest stable release and the
> latest nightly build. (http://www.eclipse.org/nebula/downloads.php)
>
> - Try to remove moviesGallery.setVirtualGroups(true); . This method
> improves init time when a lot of groups are used ( 50+). It is totally
> useless in your case and since this is a quite new feature, it may be
> the issue.
>
> - Your setData handler should test if the item is a group or an item.
> (getParentItem() == null for groups). You are setting item count > 0 for
> every item. This currenlty works because renderers only paint 2 levels
> of items, but will create an infinite loop in the future.
>
> - If this does not solve your problem, open a bug and attach a Junit
> test case or a snippet showing the bug (see
> http://www.eclipse.org/swt/snippets/ for sample snippets).
>
Thanks!!!. When i removed "moviesGallery.setVirtualGroups(true), i've
executed the app, and it works!!! Now selects fine the first element.
The apps works with: moviesGallery.setSelection( new GalleryItem[]{
moviesGallery.getItem(0).getItem(number) } );
and now, i'm able to select programmatically every number i want. I
suppose the order is: moviesgallery.getItem(group).getItem(number of a
item in this group). Is this right?
|
|
|
Goto Forum:
Current Time: Mon Sep 23 08:17:30 GMT 2024
Powered by FUDForum. Page generated in 0.05173 seconds
|