I check out 4D's components every few versions and am now doing so in V16.
I've got a big pile of code that would be nicer to use as a component. It's
got a few well-defined entry points/functions accessed via passed
parameters and callbacks, so there are already no shared variables to worry
about.
But the callbacks....The main code runs in a worker that takes calls via
CALL WORKER. Sometimes, the outside code needs an answer, which is
delivered via a callback via CALL WORKER or CALL FORM. So, an input to the
component is the name of method in the host database.
The basic mechanics of this are fine: set the callback method in the host
as 'shared with component and host database'. But now we get to my question:
What if there is already a method inside of the component with the same
name in the host?
Say I've got
InfoCatchCallback - not shared with host (nor should it be)
...in the component (I don't, just saying) and then in the host database
I've got
InfoCatchCallback - shared with component (must be)
So, there are two different methods with the same name - one in the
component and one in the host. As far as I can tell, this won't work. 4D
calls the copy in the component and nothing happens in the host. I just ran
into this by accident, check the docs...and couldn't find any sort of
discussion. It looks like there's no explicit syntax to say 'execute in the
host method.'
Is this correct? If so, how do people deal with this problem? All that I
can think of is to validate the input within the component. Before calling
the callback, you check if it's in the method lest for the component and
the host. Seems inefficient. Also, I'm not sure if this is even
possible...is there a way to test the calling context? Meaning, is there a
way to know if the call originates from the host or from another component
method? The component relies on callbacks internally as well.
Anyway, I'm looking for some confirmation, clarification, and a solution
that doesn't depend on luck.
Sorry if this is super basic and obvious....but I did warn that it's a
remedial question...
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************