TlistItem.data - store and use a word/integer?

Posted on 1999-07-14
Medium Priority
Last Modified: 2012-08-13
How do I store a word or integer in the TlistItem.data property and then get it in a usable form? I tried
ListItem.Data := addr(wordvar);
this results in a pointer, but how do I convert this to a value I can use?
Question by:gelat
  • 2
LVL 12

Accepted Solution

rwilson032697 earned 400 total points
ID: 1388629
Just cast the pointer back to what you want:

MyValue := Integer(ListItem.Data);



LVL 12

Expert Comment

ID: 1388630
I need to add something. The answer is correct (though you would cast with word for a word value), but you need to set the value differently...

Do it like this:

ListItem.Data := Pointer(WordVar);




Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This is an update to some code that someone else posted on Experts Exchange. It is an alternate approach, I think a little easier to use, & makes sure that things like the Task Bar will update.
Watch the video to know how one can repair corrupt Exchange OST file effortlessly and convert OST emails to MS Outlook PST file format by using Kernel for OST to PST converter tool. It can convert OST to MSG, MBOX, EML to access them. It can migrate…
Watch the video of Kernel Migrator for SharePoint, which demonstrate the process easily of migration from SharePoint to SharePoint, OneDrive for Business & Google Drive servers, Public Folder to SharePoint, File Server to SharePoint. The tool has va…
Suggested Courses

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question