Carl Reynolds asked
> Come on everyone, haven't any of you ever wanted to subclass a component
> on a form without either sticking yet another
> "TAnotherSubclassedComponentThatsNeededForOneParticularFormButICouldntTe
> llYouWhyOrWhatItDoesWithoutLookingAtItAgain" component into the
> component palette, or creating and keeping track of "helper objects"?
I have come across this situation occasionally, but when I do the first
things that I think about is if the required behaviour modification can be
achieved by taking the base class and adding an event notification that
can be published and used to handle the special case.
In 80% of the cases I have struck the 'special case' is really a behaviour
modification or drawing change that an event can support easily. This is
usually accompanied by a realisation that the component in question should
have had the event in the first place, but when I wrote it is 'saved time'
by not including it.
The other 20% are a change that alters a components behaviour so much that
I then start looking at what I really want to achieve and start thinking
about building a new component that supports what is needed.
> One of the advantages of my suggestion is that it would be very easy to
> implement. One tiny extra situation to check for during a compile and a
> slight relaxing of the loading rules - that's it! :)
The real issue is that if you can created new component type on a form
then you must be able to stream the component in and out cleanly. If the
component makes any modification at all to the published properties then
you need compiled code and RTTI information for the streaming to work. The
IDE is going to have to compile and generate RTTI at design time to
support streaming. If the code doesn't compile then the custom component
just can't be streamed out (not so bad) or in (really annoying).
For all its magic the IDE doesn't actually compile code in the design
environment. Internally there is a parser that does all the parsing to
allow the property editors to work, the code completion to work and the
navigation features, but it never produces any code until you choose to
compile a unit. Enhacing the IDE to do partial compiles and links at
design time to extend the IDE is a very big ask.
Cheers, Max.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Offtopic List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz