Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Getting the parent button from an event listener?
Getting the parent button from an event listener? [message #446625] Mon, 29 November 2004 22:51 Go to next message
MP Mising name is currently offline MP Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
I'm trying to add an event listener for a custom button...extends
button. What I want to do is have all the buttons call the same handler
but pass in themselves so that the function knows what button to operate on.

The compiler doesn't like using "this", it says that refers to the
function widgetSelected(). I tried SelectionEvent.item, but that's
null.

Any ideas on how I can accomplish this?

Thanks
MP
Re: Getting the parent button from an event listener? [message #446635 is a reply to message #446625] Tue, 30 November 2004 13:47 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
SelectionEvent.widget gives what you're looking for...

Grant

"MP" <dev1@levelgroundmedia.com> wrote in message
news:cog8r9$k4k$1@www.eclipse.org...
> I'm trying to add an event listener for a custom button...extends
> button. What I want to do is have all the buttons call the same handler
> but pass in themselves so that the function knows what button to operate
on.
>
> The compiler doesn't like using "this", it says that refers to the
> function widgetSelected(). I tried SelectionEvent.item, but that's
> null.
>
> Any ideas on how I can accomplish this?
>
> Thanks
> MP
Re: Getting the parent button from an event listener? [message #446700 is a reply to message #446635] Tue, 30 November 2004 23:08 Go to previous message
MP Mising name is currently offline MP Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
Grant Gayed wrote:
> SelectionEvent.widget gives what you're looking for...
>
> Grant
>
> "MP" <dev1@levelgroundmedia.com> wrote in message
> news:cog8r9$k4k$1@www.eclipse.org...
>
>>I'm trying to add an event listener for a custom button...extends
>>button. What I want to do is have all the buttons call the same handler
>>but pass in themselves so that the function knows what button to operate
>
> on.
>
>>The compiler doesn't like using "this", it says that refers to the
>>function widgetSelected(). I tried SelectionEvent.item, but that's
>>null.
>>
>>Any ideas on how I can accomplish this?
>>
>>Thanks
>>MP
>
>
>
Thank you Grant, Works great!
Previous Topic:paint over an image
Next Topic:Animate a widget
Goto Forum:
  


Current Time: Wed Oct 28 03:31:14 GMT 2020

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

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

Back to the top