Problem about ComboBoxCellEditor, loading dynamic items. [message #462373] |
Sun, 28 January 2007 06:49 |
Eclipse User |
|
|
|
Originally posted by: allenmacyoung.gmail.com
Hi all,
I have a ComboBoxCellEditor whose items is decided after the user has selected
the corresponding element in the TableViewer. Say if I select element1, its
ComboBoxCellEditor should take "A" and "B" as its items, while if I select
element2, the items should be changed to "C" and "D".
For now, I'm giving the TableViewer a ComboBoxCellEditor with empty item
set. Then I listen to the selection change event and set the ComboBoxCellEditor's
items dynamicly. The problem is that it cannot store the original selected
item when I click into the cell. For instance, suppose the ComboBoxCellEditor
holds "A" for element1, when I click into the ComboBoxCellEditor, it will
take "A" and "B" as its items, but the "A" item will not be selected anymore,
the ComboBoxCellEditor becomes empty.
I was thinking ComboBoxCellEditor's setValue method should work, so I put
the index of the selected item(for "A" is 0) in, but it didn't make any good.
I also tried to created a brand new ComboBoxCellEditor(or the whole CellEditor[]
for the TableViewer) when the different element is selected. But it seems
like that one TableViewer's CellEditors can be set only once.
I don't know if I made myself clear. Is there any suggestion on this? Thanks
a lot!
Allen
|
|
|
Re: Problem about ComboBoxCellEditor, loading dynamic items. [message #462387 is a reply to message #462373] |
Sun, 28 January 2007 17:49 |
Snjezana Peco Messages: 789 Registered: July 2009 |
Senior Member |
|
|
If you have done the following:
comboBoxCellEditor.setItems({"A","B"});
comboBoxCellEditor.setValue(new Integer(0));
then your ComboBoxCellEditor will contain "A" and B" items. The "A" item
will be selected.
I suppose that you have set some other values ("","A","B", for instance)
to the setItems method or you use incorrect parameter for the setValue
method.
Snjeza
Allen Young wrote:
> Hi all,
>
> I have a ComboBoxCellEditor whose items is decided after the user has
> selected the corresponding element in the TableViewer. Say if I select
> element1, its ComboBoxCellEditor should take "A" and "B" as its items,
> while if I select element2, the items should be changed to "C" and "D".
>
> For now, I'm giving the TableViewer a ComboBoxCellEditor with empty item
> set. Then I listen to the selection change event and set the
> ComboBoxCellEditor's items dynamicly. The problem is that it cannot
> store the original selected item when I click into the cell. For
> instance, suppose the ComboBoxCellEditor holds "A" for element1, when I
> click into the ComboBoxCellEditor, it will take "A" and "B" as its
> items, but the "A" item will not be selected anymore, the
> ComboBoxCellEditor becomes empty.
>
> I was thinking ComboBoxCellEditor's setValue method should work, so I
> put the index of the selected item(for "A" is 0) in, but it didn't make
> any good. I also tried to created a brand new ComboBoxCellEditor(or the
> whole CellEditor[] for the TableViewer) when the different element is
> selected. But it seems like that one TableViewer's CellEditors can be
> set only once.
>
> I don't know if I made myself clear. Is there any suggestion on this?
> Thanks a lot!
>
>
>
> Allen
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02968 seconds