[MacOS X.3.6] TableTree getting selected item [message #446386] |
Wed, 24 November 2004 10:07 |
Eclipse User |
|
|
|
Originally posted by: yvon_thoraval.mac.com
Hy all,
i've added a SelectionListener to my TableTree however, the indexOf
selected item returns -1 if not at index 0 and the associated text to null.
is that a known, OS dependant, bug ?
Yvon
Here is my code :
<code>
SelectionListener tableTreeListener = new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
System.out.println("widgetSelected : " + e.widget);
TableTree tt = (TableTree) e.widget;
TableTreeItem[] ttis = tt.getSelection();
int ttin = tt.getSelectionCount();
System.out.println("tti number : " + ttin);
System.out.println("tti index : " +
tableTree.indexOf(ttis[0]));
System.out.println("tti texte : " + ttis[0].getText());
}
public void widgetDefaultSelected(SelectionEvent arg0) { }
};
tableTree.addSelectionListener(tableTreeListener);
</code>
Notice that only one is selected at this time, reason for ttis[0]...
|
|
|
|
Re: [MacOS X.3.6] TableTree getting selected item [message #446422 is a reply to message #446417] |
Wed, 24 November 2004 18:40 |
Eclipse User |
|
|
|
Originally posted by: yvon_thoraval.mac.com
Veronika Irvine a écrit :
> You need to call indexOf on the parent of the TableTreeItem. Sometimes this
> is the TableTree - when the item is a root node - and sometimes the parent
> is a TableTreeItem. The same applies for Tree and TreeItems.
OK, thanks, it seems that the index value also isn't what's expected, it
gives the leaf's index below last node or something the like (i had only
one node having leafs is this first trial)
Anyway, your help's very much appreciated.
Best,
Yvon
|
|
|
Powered by
FUDForum. Page generated in 0.03287 seconds