Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Custom Event Type
Custom Event Type [message #644746] Mon, 13 December 2010 23:56 Go to next message
Eclipse UserFriend
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 08:45 Go to previous message
Eclipse UserFriend
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,
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: Wed Jul 02 03:26:03 EDT 2025

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

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

Back to the top