Walter Prins wrote:
> Anyway, I did a quick hack update to my previous suggestion source - here 
> then is a TListDecorator class that is can be attached to any TList 
> descendant (including TObjectList) as shown to add "object method sort" 
> ability...  Note though: I cheat - I do *not* reimplement/surface a complete 
> TList compatible interface in the wrapper, instead I just surface the 
> wrapped list as a property.

If you _had_ tried to surface all of TList's methods, you'd be right 
back to where you started, in a way. You'd be stuck with a TList 
wrapping a TObjectList, so all the exposed methods would be for a 
generic TList instead of the specific TObjectList. If you wanted to deal 
with TObjects again, you'd need another wrapper class. It's not as bad 
as before, though, since TObjectListDecorator could descend from 
TListDecorator, so you could have two parallel sets of classes.

> In the form code I also maintain references to 
> both the wrapped list and the wrapper.  Thus, this example is perhaps a bit 
> ugly and isn't really in the "spirit" of how it should be for a proper 
> wrapper, but even so, (returning to the actual problem) this solution to 
> circumventing the sort function vs. method issue is still IMHO far less 
> awkward than the original jiggery pokery that Dave wanted to improve I 
> think.

In this case, I don't think a wrapper is even necessary (which might 
explain why the wrapper doesn't quite "feel right"). You could just as 
easily have a standalone procedure that takes a TList reference and a 
method pointer. That's essentially what the QuickSort procedure in 
Classes.pas does anyway.

-- 
Rob



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to