Re: advise on style


2004-02-21 04:49:57 AM
cppbuilder41
"Benjamin Pratt" < XXXX@XXXXX.COM >wrote in message
Quote
I'm not sure exactly how this will help. Can you clarify?
Why don't you explain exactly what you are trying to accomplish in the first
place, and then we can talk about how best to actually implement it.
Quote
1. CreateNode does not have access to the Data member
and takes no parameters.
You are missing the point. You can extend TTreeNode to contain whatever you
want as extra propeties and such, and then once the Add() methods have
returned with the new node, the caller can fill it in however it wants.
CreateNode() is only meant for creating an instance of a node class. The
caller still has to fill it in. That is no different then you wanting to
have an event that notifies of a new node being added, since you would still
have to fill in the node yourself anyway.
Quote
2. The Data member is a pointer to a polymorphic type. Hence all Data
members do not point to the same absolute type.
Makes no difference what you are putting in the Data property, you are still
assigning the Data yourself anyway.
Quote
3. The data member points to an existing instance who's lifetime is not
tied to the TTreeNode's lifetime. So creating the instance in CreateNode
is not possible.
I did not say for you to create the Data instance in CreateNode(). But you
can expose access to the newly created Node instance so that you can assign
its Data to whatever you need.
Quote
I think your suggestion of firing an OnAddition Event just
before InsertObject (and InternalAddObject) returns is the
best. I assume this is how OnAddition is implemented in BCB6.
Yes. Although the actual triggering is implemented in several different
places.
Quote
I made the modifications successfully to comctrls.pas, but it
seemed to continue to use the old comctrls.pas file.
Did you disable runtime packages? Did you make sure not to change anything
of the file's interfaces? Did you actually add the patched file directly to
your project?
Quote
Would I need to staticly link instead of dynamic?
Yes.
Gambit