<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">OK, I now have this code:</div><div class="gmail_default"><div class="gmail_default"><font face="arial, helvetica, sans-serif">with tvMain.Items.AddChildObject(tvMain.Selected,IntToStr(fUserList.Items[I].Id),Pointer(fUserList.Items[I].Id)) do</font></div>
<div style="font-family:arial,helvetica,sans-serif"><br></div></div><div class="gmail_extra"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">and this:</div><div class="gmail_default"><font face="arial, helvetica, sans-serif">procedure TfrmMain.tvMainChange(Sender: TObject; Node: TTreeNode);</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif">begin</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> if Assigned(Node.Data) then</font></div><div class="gmail_default">
<font face="arial, helvetica, sans-serif"> ShowMessage('Node ' + IntToStr(PtrInt(Node.Data)));</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">end;</font></div><div class="gmail_default">
<span style="font-family:arial,helvetica,sans-serif"></span><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">And I am now getting an exception when my app run?</div><br><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
Richard</div><br><div class="gmail_quote">On 11 September 2013 09:24, Antonio Fortuny <span dir="ltr"><<a href="mailto:a.fortuny@sitasoftware.lu" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=a.fortuny@sitasoftware.lu&cc=&bcc=&su=&body=','_blank');return false;">a.fortuny@sitasoftware.lu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<br>
<div>Le 11/09/2013 07:51, Richard Mace a
écrit :<br>
</div><div class="im">
<blockquote type="cite">
<div dir="ltr">
<div style="font-family:arial,helvetica,sans-serif">Hi,</div>
<div style="font-family:arial,helvetica,sans-serif">Can anyone give
me an example of adding and retrieving an integer value to a
TTreenode via it's data property please?</div>
<div style="font-family:arial,helvetica,sans-serif"><br>
</div>
<div style="font-family:arial,helvetica,sans-serif">I've tried the
below, but it doesn't seem to work.</div>
<div style="font-family:arial,helvetica,sans-serif"><br>
</div>
<div style="font-family:arial,helvetica,sans-serif">Set:</div>
<div>
<div>
<font face="arial, helvetica, sans-serif">with
tvMain.Items.AddChildObject(tvMain.Selected,'string',TObject(fUserList.Items[I].Id))
do</font></div>
</div>
</div>
</blockquote>
</div><font face="arial, helvetica, sans-serif">change to:</font><br>
<font face="arial, helvetica, sans-serif">with
tvMain.Items.AddChildObject(tvMain.Selected,'string', <b><big>Pointer</big></b>(fUserList.Items[I].Id))
do</font><div class="im"><br>
<blockquote type="cite">
<div dir="ltr">
<div>
<div style="font-family:arial,helvetica,sans-serif"><br>
</div>
<div style="font-family:arial,helvetica,sans-serif">
<br>
</div>
<div style="font-family:arial,helvetica,sans-serif">and
getting as, throws an exception on start:</div>
<div>
<div>
<div>procedure TfrmMain.tvMainChange(Sender: TObject;
Node: TTreeNode);</div>
<div>begin</div>
<div>
ShowMessage('Node ' + IntToStr(Integer(Node.Data)));</div>
</div>
</div>
</div>
</div>
</blockquote></div>
change to:<br>
ShowMessage('Node ' + IntToStr(<b>PtrInt</b><b><big></big></b>(Node.Data)));<br>
<br>
Antonio.<br>
</div></blockquote></div><br></div></div>