events

BlitzMax Forums/BlitzMax Beginners Area/events

almost ..

..but not yet :D

I think there should simply be an events-method. And the only thing the hook should do is call that events-method. The hook function shouldn't do the actual events itself.

This event function would look like this:

Method Events()

  If EventSource()=gadget1
    If EventID()=id1
    EndIf
    If EventID()=id2
    EndIf
  Endif

  If EventID()=id3 ; just for this order-swapping I'm not much a fan of Select-Case constructions..
    If EventSource()=gadget2
    EndIf
    If EventSource()=gadget3
    EndIf
  Endif
  ; And yes, you can assume there's more than 1 gadget for an object like this..

End Method



Actually I'm surprised this baby takes so long to deliver :P The idea isn't that strange I'd say.

- create independent unlisted local object
- create event-function for object
- create eventhook that calls that event-function

- and next step: emit new unique events so I can use this object everywhere


The endgoal is that there's a means to create new GUI gadgets and other self-contained objects that look 100% transparent with the rest of the gadgets. So it must work in a 100% similar way.