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

    On Tue, Nov 23, 2010 at 1:59 PM, Max Vlasov <max.vla...@gmail.com
    <mailto:max.vla...@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.



If you create the menuItem at runtime, you can always use a sub-class, create your own class TMyMenuItem, with a property and field to store the data..

That is what OO is for....
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to