[REBOL] Re: Enage and Select
From: greggirwin:mindspring at: 17-Sep-2003 9:44
Hi Matt,
MM> But what if I want to extend the functionality of a specific handler?
MM> for instance, if I wanna keep the highlighting functionality, and also have
MM> auto-scroll when the user clicks and drags off the face? Both would be
MM> handled by the over and away actions. If I'm reading the last responce to
MM> this correctly, the idea is to copy the old engage function into a new
MM> function, then make a new engage function. Then call the appropriate engage
MM> function based on the action you are trying to handle. Am I right? Is this
MM> possible, or am I just asking too much?
What Romano posted shows how you can create your own and then "pass
along" events to the original handler by calling it from your
function.
Depending on what you're doing, there may be issues with that approach.
This is not a REBOL thing, but applies to any system where you try to
inherit and extend functionality. The original code has no idea what
you're doing, so it expects things to be as they were. For example,
the swiping/highlighting code may expect the start position to be
visible on the screen, but if you drag down and auto-scroll, it isn't
anymore. There may be interactions that you have to account for
between your new stuff and what's there already. There may also be
times where you need to call the base function before or after your
code, but not always one or the other. That is, depending on what
you're doing, you may need to decide whether to do the work first, or
call the base function first and then do your work.
Of course, you can always try it and see what happens. Sometimes
things just magically seem to do what you want. :)
-- Gregg