[fpc-devel] Component FTag and Tag should be int64

Max Vlasov max.vlasov at gmail.com
Tue Nov 23 22:09:53 CET 2010

On Tue, Nov 23, 2010 at 11:32 PM, Andrew Brunner <andrew.t.brunner at gmail.com
> wrote:

> On Tue, Nov 23, 2010 at 1:59 PM, Max Vlasov <max.vlasov at gmail.com> wrote:
>> Andrew,
>> Creating TList as a field for storing extra structures and objects and
>> supporting extra data reference using Tag as an index never was a problem
>> for me. Can you tell a single reason not to implement this approach by
>> yourself?  Moreover managing the destruction of objects in this case is much
>> easier and straightforward.
>> Other consideration, if something starts to depend on future decisions of
>> other developers, isn't it easy to create a simple (very simple) workaround
>> :)
>> Max Vlasov
> In the specific problem I have, it is corellating TMenuItem with a
> particular data pointer object of TForm.  Forms can close out of order and
> re-Index the List I have (as you stated).  But there is no clean way for me
> to reference what was clicked on Sender...  Tag or Data is the only clean
> solution here.  Out of order, happening on application thread... Oh, and
> TMenuItems being created at runtime.  This is about productivity.  What must
> I create an additional list when I have Tag or Data.
Things become a little more complex in this case, but just a little,
[id:pointer] where id is autoincrement. You can have two synchronized lists
(TList), one stored ids, another one - corresponding object. Or create a
list with a record containing both. I'm from Turbo Pascal era so dynamic
"array of" was a kind of novelty some time ago for me and I created an
analogue. But this time [array of record id: integrer; ptr: pointer end;] is
no longer a problem and you have privilege to use a language already
containing such a great dynamic structure :)

I also must say (probably others will confirm) that programming starting
turbo pascal gave me once and for good the sense that  the design-time
objects and data are a great help, but just secondary help, everything solid
comes from elsewhere.

Max Vlasov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20101124/a0560930/attachment.html>

More information about the fpc-devel mailing list