Michael Van Canneyt wrote:


On Mon, 4 Sep 2006, peter green wrote:



Me2.

Just one disadvantage:
The Tag is published.
If someone stores a 64bit value and the component is stored,
the stream can not be read under 32bit anymore.

...which makes it impossible to use streams for anything derived from
Tcomponent, which is really a lot. I don't think we should break this
feature to allow broken code to work.
ahh the joys of conflicting requirements,

I don't consider storing a pointer in the tag is broken code, it was
considered the accepted way to maintain a pointer to your custom data from a
standard control and there is often no simple alternative.

Accepted only because there was no other way.

The only correct way is to introduce an additional field 'UserData', of type Pointer.

A pointer cannot be stored anyway at design-time, so it does not need to be published.

Remains the decision where you introduce this pointer: TComponent, TControl.

IMHO, you should introduce TLCLComponent, add it there, and descend all LCL components from that.

TLCLComponent is already exists (it's only not committed yet.
Adding a UserData to it is maybe an idea.
THis will work for most compoenents, except DB components for instance.

Marc

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to