Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SelectionListener not called when setSelection invoked?
SelectionListener not called when setSelection invoked? [message #458623] Sun, 17 July 2005 00:27 Go to next message
Agnes Freese is currently offline Agnes FreeseFriend
Messages: 14
Registered: July 2009
Junior Member
Hi,

I have a Tree control in a TreeViewer in eclipse 3.1. I want to change the
selected item in the tree when something is dragged on top of it. I used
Tree.setSelection(TreeItem) to set the selected item to the one that is the
drop target. If I call getSelection immediately afterwards the correct item
is now marked as selected.

I also have a SelectionListener for the tree. This is called correctly when
I click on items in the tree and the selection changes, however, when I set
the selection with Tree.setSelection, the SelectionListener is not invoked.
Is this the normal behavior ? bug? or perhaps something I am doing wrong?

Thanks,
Agnes
Re: SelectionListener not called when setSelection invoked? [message #458625 is a reply to message #458623] Sun, 17 July 2005 05:13 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Agnes Freese:

This is normal. Just call handler yourself, if you need.

In other case (if it calls it automatically) you will need more
changes: add field flag that say, if this selection is because you set
it and it should not be handled, plus you will need to set/clear in and
also check in handler.

> I have a Tree control in a TreeViewer in eclipse 3.1. I want to change the
> selected item in the tree when something is dragged on top of it. I used
> Tree.setSelection(TreeItem) to set the selected item to the one that is the
> drop target. If I call getSelection immediately afterwards the correct item
> is now marked as selected.
>
> I also have a SelectionListener for the tree. This is called correctly when
> I click on items in the tree and the selection changes, however, when I set
> the selection with Tree.setSelection, the SelectionListener is not invoked.
> Is this the normal behavior ? bug? or perhaps something I am doing wrong?
>
> Thanks,
> Agnes
>
>


Konstantin Scheglov,
Google, Inc.
Re: SelectionListener not called when setSelection invoked? [message #458666 is a reply to message #458625] Mon, 18 July 2005 19:29 Go to previous message
Agnes Freese is currently offline Agnes FreeseFriend
Messages: 14
Registered: July 2009
Junior Member
Thanks Konstatin, I called notifyListeners to invoke the event on the
listener and this is working for me.


"Konstantin Scheglov" <kscheglov@gmail.com> wrote in message
news:dbcpet$384$1@news.eclipse.org...
> Agnes Freese:
>
> This is normal. Just call handler yourself, if you need.
>
> In other case (if it calls it automatically) you will need more
> changes: add field flag that say, if this selection is because you set
> it and it should not be handled, plus you will need to set/clear in and
> also check in handler.
>
> > I have a Tree control in a TreeViewer in eclipse 3.1. I want to change
the
> > selected item in the tree when something is dragged on top of it. I
used
> > Tree.setSelection(TreeItem) to set the selected item to the one that is
the
> > drop target. If I call getSelection immediately afterwards the correct
item
> > is now marked as selected.
> >
> > I also have a SelectionListener for the tree. This is called correctly
when
> > I click on items in the tree and the selection changes, however, when I
set
> > the selection with Tree.setSelection, the SelectionListener is not
invoked.
> > Is this the normal behavior ? bug? or perhaps something I am doing
wrong?
> >
> > Thanks,
> > Agnes
> >
> >
Previous Topic:ScolledComposite with Text wrap
Next Topic:Dynamically showing and hiding columns in a SWT Table
Goto Forum:
  


Current Time: Sat Apr 20 03:03:41 GMT 2024

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

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

Back to the top