[Lazarus] Adding data field to a child node in a treeview

Susie Nicol susie.k.nicol at gmail.com
Sat Jul 4 12:02:13 CEST 2015


Thanks heaps guys. That's great.

On Sat, Jul 4, 2015 at 9:00 PM, Howard Page-Clark <hdpc at talktalk.net> wrote:

> On 04/07/2015 09:46, Susie Nicol wrote:
>
>> Hi - me again
>>
>> I have a Lazarus treeview, which I am populating from several sql queries.
>>
>> I add  child nodes in this way, setting them to one of the fields
>> returned from the query
>>
>>             while Not SQLQuery1.EOF do
>>            Begin
>>
>>            treeview1.items.addchild(treeview1.selected,
>> SQLQuery1.fields[0].AsString);
>>
>>             SQLQuery1.Next
>>            end;
>>
>> That works of course.
>>
>> I want to modify the newly added node by setting its data property to
>> another field in the loop - something like
>>
>>      treeview1.SOMETHING.data := Pointer(SQLQuery1.fields[1].AsInteger);
>>
>> but the problem is that I can't work out how to identify the newly-added
>> child node.  Is it possible?
>>
>
> var
>   node: TTreeNode;
> begin
>
> node:=TreeView1.Items.AddChild(TreeView1.Selected,SQLQuery1.Fileds[0].AsString);
> node.Data:=pointer(SQLQuery1.Fields[0].AsInteger);
> SQLQuery1.Next;
> end;
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150704/dccf505a/attachment-0003.html>


More information about the Lazarus mailing list