[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

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.