I understand that you are casting the context object as a TSmartSpinner, and then passing data cast as a TEvent to its 'ev' method. But what does the condition if TSmartspinner(context) test?
I dunno, I always c/p this thing from source to source, only changing the names. I'd say: it works, don't bother with it, it'll only give you headaches trying to understand it, and you won't really gain much when you do. :P
Second question, in your update() method, you emit a new event with id = EVENT_SMARTSPINNERUPDATE. In the documentation you explain that this is to be captured by external hook functions. Could you give me an example of why you would want this to be hooked in a program? I.e. what would a hooker do upon receiving the above event?
I want the update (e.g. the drawing of the spinner) external and hooked, which has these advantages:
- they're not hardwired, meaning that all I need to do is create a function and hook it, I never need to touch the original spinner engine again.
- by having it external, I won't get a spinner engine with a 3000 lines Select-Case construction, containing all the possible spinners. (This was actually the main reason to investigate external hooked functions some years ago when I was working on a texture generator, wanting to avoid a core engine of 10000 lines just because it contained all the texture effects)