Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Does setSelection(index) on a grid invoke the selectionListener attached to it?
Does setSelection(index) on a grid invoke the selectionListener attached to it? [message #46166] Thu, 10 January 2008 11:17 Go to next message
Asha Subramaniam is currently offline Asha SubramaniamFriend
Messages: 5
Registered: July 2009
Junior Member
Hello all,

I have a grid and I have added a Selection Listener to it.

I wanted to know if on executing the following line of code, will this
listener get invoked:

grid.setSelection(index).

My requirement is that, when I set the selection to a gridItem using the
above line of code, the selection listener associated with it should be
invoked.

I have tried this but the selection listener is not getting fired. How can
I invoke the listener?

Any suggestion would be appreciated.

Thanks and Regards,
Asha Subramaniam.
Re: Does setSelection(index) on a grid invoke the selectionListener attached to it? [message #46196 is a reply to message #46166] Thu, 10 January 2008 11:29 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
This is common to all SWT-Widget and I think Grid behaves like real
native ones. Setting a selection through code will never trigger an event.

In standard SWT you have to call notifyListener() your own but I don't
know if this is the same in Nebula-Grid.

Tom

Asha Subramaniam schrieb:
> Hello all,
>
> I have a grid and I have added a Selection Listener to it.
> I wanted to know if on executing the following line of code, will this
> listener get invoked:
> grid.setSelection(index).
>
> My requirement is that, when I set the selection to a gridItem using the
> above line of code, the selection listener associated with it should be
> invoked.
>
> I have tried this but the selection listener is not getting fired. How
> can I invoke the listener?
>
> Any suggestion would be appreciated.
>
> Thanks and Regards,
> Asha Subramaniam.
>
>
>
>
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Does setSelection(index) on a grid invoke the selectionListener attached to it? [message #46226 is a reply to message #46196] Thu, 10 January 2008 16:00 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
Messages: 253
Registered: July 2009
Senior Member
Yes its as Tom says. This is the standard SWT pattern. Since its your
code doing the selection (as opposed to the user) then you can do any
follow on processing that you want (or fire the event as Thomas suggests
with notifyListeners()).

Regards,
-Chris

Tom Schindl wrote:
> This is common to all SWT-Widget and I think Grid behaves like real
> native ones. Setting a selection through code will never trigger an event.
>
> In standard SWT you have to call notifyListener() your own but I don't
> know if this is the same in Nebula-Grid.
>
> Tom
>
> Asha Subramaniam schrieb:
>> Hello all,
>>
>> I have a grid and I have added a Selection Listener to it.
>> I wanted to know if on executing the following line of code, will this
>> listener get invoked:
>> grid.setSelection(index).
>>
>> My requirement is that, when I set the selection to a gridItem using
>> the above line of code, the selection listener associated with it
>> should be invoked.
>>
>> I have tried this but the selection listener is not getting fired. How
>> can I invoke the listener?
>>
>> Any suggestion would be appreciated.
>>
>> Thanks and Regards,
>> Asha Subramaniam.
>>
>>
>>
>>
>>
>
>
Re: Does setSelection(index) on a grid invoke the selectionListener attached to it? [message #46321 is a reply to message #46226] Fri, 11 January 2008 06:17 Go to previous message
Asha Subramaniam is currently offline Asha SubramaniamFriend
Messages: 5
Registered: July 2009
Junior Member
Thanks Tom and Chris,

I will try out the solution.

Regards,
Asha Subramaniam.
Re: Does setSelection(index) on a grid invoke the selectionListener attached to it? [message #587528 is a reply to message #46166] Thu, 10 January 2008 11:29 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
This is common to all SWT-Widget and I think Grid behaves like real
native ones. Setting a selection through code will never trigger an event.

In standard SWT you have to call notifyListener() your own but I don't
know if this is the same in Nebula-Grid.

Tom

Asha Subramaniam schrieb:
> Hello all,
>
> I have a grid and I have added a Selection Listener to it.
> I wanted to know if on executing the following line of code, will this
> listener get invoked:
> grid.setSelection(index).
>
> My requirement is that, when I set the selection to a gridItem using the
> above line of code, the selection listener associated with it should be
> invoked.
>
> I have tried this but the selection listener is not getting fired. How
> can I invoke the listener?
>
> Any suggestion would be appreciated.
>
> Thanks and Regards,
> Asha Subramaniam.
>
>
>
>
>


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: Does setSelection(index) on a grid invoke the selectionListener attached to it? [message #587544 is a reply to message #46196] Thu, 10 January 2008 16:00 Go to previous message
Chris Gross is currently offline Chris GrossFriend
Messages: 471
Registered: July 2009
Senior Member
Yes its as Tom says. This is the standard SWT pattern. Since its your
code doing the selection (as opposed to the user) then you can do any
follow on processing that you want (or fire the event as Thomas suggests
with notifyListeners()).

Regards,
-Chris

Tom Schindl wrote:
> This is common to all SWT-Widget and I think Grid behaves like real
> native ones. Setting a selection through code will never trigger an event.
>
> In standard SWT you have to call notifyListener() your own but I don't
> know if this is the same in Nebula-Grid.
>
> Tom
>
> Asha Subramaniam schrieb:
>> Hello all,
>>
>> I have a grid and I have added a Selection Listener to it.
>> I wanted to know if on executing the following line of code, will this
>> listener get invoked:
>> grid.setSelection(index).
>>
>> My requirement is that, when I set the selection to a gridItem using
>> the above line of code, the selection listener associated with it
>> should be invoked.
>>
>> I have tried this but the selection listener is not getting fired. How
>> can I invoke the listener?
>>
>> Any suggestion would be appreciated.
>>
>> Thanks and Regards,
>> Asha Subramaniam.
>>
>>
>>
>>
>>
>
>
Re: Does setSelection(index) on a grid invoke the selectionListener attached to it? [message #587569 is a reply to message #46226] Fri, 11 January 2008 06:17 Go to previous message
Asha Subramaniam is currently offline Asha SubramaniamFriend
Messages: 5
Registered: July 2009
Junior Member
Thanks Tom and Chris,

I will try out the solution.

Regards,
Asha Subramaniam.
Previous Topic:[Grid] How to set RowHeaderWidth ?
Next Topic:Brainstorming: grid as a spreadsheet
Goto Forum:
  


Current Time: Sat Apr 27 04:33:31 GMT 2024

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

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

Back to the top