Selection event not fired for tree.setSelection() [message #455258] |
Wed, 11 May 2005 07:41 |
Eclipse User |
|
|
|
Originally posted by: CupertinoIndian.yahoo.com
I am programmatically trying to select a node of a tree. I was able to
do everything using tree.setSelection() method. However it doesnt fire
the selection event and hence the handler is never called. If I manually
select the item, the event is fired. Is this correct behavior?
Here is my code registering for the selection event.
tree.addListener(SWT.Selection, new Listener(){
public void handleEvent(Event event) {
TreeItem[] itemsSelected = tree.getSelection();
// do something with the selected items;
}
}
|
|
|
Re: Selection event not fired for tree.setSelection() [message #455270 is a reply to message #455258] |
Wed, 11 May 2005 09:11 |
Konstantin Scheglov Messages: 555 Registered: July 2009 |
Senior Member |
|
|
Cupertino Indian:
>
> I am programmatically trying to select a node of a tree. I was able to
> do everything using tree.setSelection() method. However it doesnt fire
> the selection event and hence the handler is never called. If I manually
> select the item, the event is fired. Is this correct behavior?
Yes, because you not always want selection event, and if you don't
want and it sent, you have to create flag, set it, check, etc. In
current variant you just need call your handler, if you want.
>
> Here is my code registering for the selection event.
>
> tree.addListener(SWT.Selection, new Listener(){
> public void handleEvent(Event event) {
> TreeItem[] itemsSelected = tree.getSelection();
> // do something with the selected items;
> }
> }
--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Konstantin Scheglov,
Google, Inc.
|
|
|
Powered by
FUDForum. Page generated in 0.02837 seconds