Hey Theo, 

In Java you might solve this problem by passing an inner class, in other
languages a 'future'.  In RealBasic I think you've hit on the two easiest 
solutions.

Create a public, well-named method that does the work and is only applicable
during the event.  Something like GetWhereInfoForCurrentMatch() seems
descriptive enough to me, and with enough documentation I think it's fine.  If
people use your classes you'd expect them to look over the documentation...  You
could always raise an exception if they call it outside of an event.

Though, I like your other idea just as well.  Pass a reference to an object
implementing an interface (e.g. IItemInfoProvider) that declares a single method
to return the search location information for an Item.  This object could simply
be a subclass of SuperSearch that implements this interface and the code to find
the match information.  

Taking this idea a step further you could simply extend the Item class with the
appropriate method to return it's location (possibly by interfacing with
SuperSearch through another object, or by doing some computation, etc..).

Of course, in both the second and third solution you would still have to
document whether the WhereWasTheItemFound() method could be called on the Item
or IItemInfoProvider after the event is over...  So you're simply repackaging
your problem (but hopefully making it a little bit clearer).

Hope this helps, 
jp
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to