Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Custom Event Type
Custom Event Type [message #644746] Tue, 14 December 2010 04:56 Go to next message
Andrew Wakeling is currently offline Andrew Wakeling
Messages: 1
Registered: December 2010
Junior Member
Hi,

I would like to create a custom event type.

This custom type should create a new integer constant which will be used in addListener and also notifyListeners.

e.g.

public static final int MY_EVENT = 0x1000;
...
someComposite.notifyListeners(MY_EVENT, new Event());


Is there a standard way to create a new custom event type?

Any replies on this topic will be appreciated.

Re: Custom Event Type [message #645068 is a reply to message #644746] Wed, 15 December 2010 13:45 Go to previous message
Lakshmi Shanmugam
Messages: 274
Registered: July 2009
Location: India
Senior Member
Hi,

When you create your own Event id and reuse the SWT event mechanism for it, its possible that the event id will be used by SWT in future and then there will be a clash.
If you are creating your own wiget/composite, you can create custom events and listeners. Please take a look at the Custom events in SWT such as LocationEvent, TitleEvent. and WebBrowser.addLocationListener(), WebBrowser.addTitleListener.
1) create custom event by extending TypedEvent.
2) create listener interface by extending EventListener

Also, please see this article for a discussion on events and listeners for custom widgets--> http://www.eclipse.org/articles/Article-Writing%20Your%20Own %20Widget/Writing%20Your%20Own%20Widget.htm

HTH,


Lakshmi P Shanmugam
Previous Topic:XWT and Eclipse 3.6??
Next Topic:RCP application should be freezed when a fileDialog is open from a Wizard with aprogress monitor
Goto Forum:
  


Current Time: Fri Oct 31 10:13:06 GMT 2014

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

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