Skip to main content

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


As I said before, untyped listeners are not for use outside of SWT.  Yes, there would be a conflict.
If we decided to open the mechnism up, you would need to either register dynamically for an event
number or there would be a reserved range that could overlap in user code but never in SWT.
That is, two different user written controls could use the same numbers leading to a problem if one
was ever a subclass of the other ... which normally shouldn't happen ... but could.  Registering is
safer but means that the constants could not be used in a case statement because the values
could not be determined at compile time.



"Erik Poupaert" <erik.poupaert@xxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

02/27/2003 02:21 PM
Please respond to platform-swt-dev

       
        To:        <platform-swt-dev@xxxxxxxxxxx>
        cc:        
        Subject:        [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)?

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev



Back to the top