Skip to main content



      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 03: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 05:11 Go to previous message
Eclipse UserFriend
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)
Previous Topic:SWT_AWT bridge problems
Next Topic:Displaying Action Image on Toolbar but *not* Menu
Goto Forum:
  


Current Time: Sun Jul 06 15:54:39 EDT 2025

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

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

Back to the top