Table setSelection() bug? [message #448088] |
Fri, 31 December 2004 01:25 |
Eclipse User |
|
|
|
Originally posted by: gopowereclipse.yahoo.com
I have a table (SWT table widget) and populated the table with a number of
rows. I want to programmatically set the selection to the first row. I have
a SelectionListener registered with the table. When I use
table.setSelection(0);
to set the selection to the first row, my SelectionListener is not notified.
However, mouse selection on the table rows does trigger the
SelectionListener. Is this a bug? How can I programmatically set selection
and be notified that the selection has happened? Thanks a lot for your help.
--Vivian
|
|
|
Re: Table setSelection() bug? [message #448098 is a reply to message #448088] |
Sat, 01 January 2005 20:40 |
Eclipse User |
|
|
|
Originally posted by: micasim.gmx.de
On Thu, 30 Dec 2004 17:25:45 -0800, Vivian <gopowereclipse@yahoo.com>
wrote:
>
> I have a table (SWT table widget) and populated the table with a number
> of
> rows. I want to programmatically set the selection to the first row. I
> have
> a SelectionListener registered with the table. When I use
> table.setSelection(0);
> to set the selection to the first row, my SelectionListener is not
> notified.
> However, mouse selection on the table rows does trigger the
> SelectionListener. Is this a bug? How can I programmatically set
> selection
> and be notified that the selection has happened? Thanks a lot for your
> help.
>
> --Vivian
>
>
Hi Vivian,
don't know for sure but I guess it's a featue. Assume a Tree and Table
combination (as in many explorers). The Table listens for selection events
on the tree and vice versa. When a the table gets informed about a
selection event on the tree it sets its own selection accordingly. If a
selection event was triggered, the tree would get informed and would set
its selection again and the never ending loop is ready to start.
When setting the selection via setSelection() you also can fire the event
programmaticaly, if you're sure not to risk a endless loop like the one
described.
hope this helps,
Michael
|
|
|
Powered by
FUDForum. Page generated in 0.03401 seconds