Skip to main content

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 WakelingFriend
Messages: 1
Registered: December 2010
Junior Member

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.


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 P ShanmugamFriend
Messages: 277
Registered: July 2009
Location: India
Senior Member

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--> %20Widget/Writing%20Your%20Own%20Widget.htm


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: Mon Mar 01 05:25:51 GMT 2021

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

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

Back to the top