Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] event numbers in SWT

You may think I'm obsessed with the actual numbers for events in SWT, like
keyDown=1, but it bugs me a bit.

If I understand this right, you can make a typedListener in your own
application (which of course implements Listener), and at first glance don't
care about numbering conflicts, since EventTable will simply invoke
handleEvent() in your custom typedListener, and from there on, it's your
custom typedListener's job to interpret any event number that can be found
in Event.type.

So, an eventtype is fully qualified by both its listener and its number. You
need the tuple to identify it.

But then I've found at least one method that simply works with the event
number. It doesn't take into account the fact that every typedListener could
implement its own numbering (in EventTable):

public boolean hooks (int eventType) {
	...
}

This function seems to assume that event numbers are unique across all
typedListeners. So, my question is: Should event numbers be unique across
typedListeners? Will it break something if I create an eventtype myEvent=1
(which conflicts with keyDown=1)?



Back to the top