Giuliano Colla wrote:
> Vincent Snijders ha scritto:
>> Florian Klaempfl schreef:
>>> Vincent Snijders schrieb:
>>>> Hi,
>>>>
>>>> The listview example doesn't run on 64 bit computers. This is caused by
>>>> the fact that the listview example contains listview items. Those items
>>>> are streamed by reading/writing a TItemInfo record for each item with
>>>> the following code:
>>>>       Stream.ReadBuffer(ItemInfo, SizeOf(ItemInfo));
>>>>
>>>> Because TItemInfo contains a pointer, the size of TItemInfo is not the
>>>> same on 32 bits platforms as on 64 bits platforms. The example is
>>>> stored
>>>> with a TItemInfo with a 4 bytes data field, the 64 bits lazarus version
>>>> reads a 8 byte field and in the end more data will be read then
>>>> there is
>>>> available.
>>>>
>>>> How can this be solved? 
>>>
>>> Steaming data seems useless to me? So stream only the first four
>>> elements one by one?
>>>
>>> Stream.ReadBuffer(ItemInfo.ImageIndex, SizeOf(ItemInfo.ImageIndex));
>>> ...
>>> Stream.ReadBuffer(ItemInfo.SubItemCount, SizeOf(ItemInfo.SubItemCount));
>>>
>>
>> That is another option.
>>
>>>> Should we change the ListItem.Data property to
>>>> an integer or a cardinal?
>>>
>>> What does it store?
>>>
>>
>> Whatever the user puts into it. I guess it is similar to TComponent.Tag.
>>
> 
> According Delphi manual:
> 
> ListItem.Data:
> <QUOTE>
> Specifies any application-specific data associated with the item
> </QUOTE>
> 
> Well, using a platform dependent type, as pointer is, to store
> application-specific data seems all but a brilliant idea.
> 
> IMHO changing it into a 32 bit type would not break backward
> compatibility, not break Delphi compatibility, but be a more sound choice.

Nothing to worry, Stream only the other members as Florian proposed.
>From the IDE there is no way to configure the Data member (so it doesn't
need to be streamed).

We might need to check if we are reading a delphi dfm

IIRC a few years ago I wondered already about streaming of pointers, and
 (again) IIRC delphi streams them


Marc

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to