Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Selection event not fired for tree.setSelection()
Selection event not fired for tree.setSelection() [message #455258] Wed, 11 May 2005 07:41 Go to next message
Eclipse UserFriend
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 Go to previous message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
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.
Previous Topic:SWT_AWT bridge problems
Next Topic:Displaying Action Image on Toolbar but *not* Menu
Goto Forum:
  


Current Time: Thu Apr 25 00:47:08 GMT 2024

Powered by FUDForum. Page generated in 0.02837 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top