I am not quite sure about some of the requirements for the VirtualTreeview - never seen it...
I know from standard TreeViews you do need to allocate the "Data" yourself (ie. the record the TreeNode.Data points to) When you are accessing the record pointed to by ".Data" I think you will have to dereference the pointer (ie MyNode.Data^.Level) I am not 100% sure about this 2+ years since I did pointer stuff in Delphi HTH Regards Paul McKenzie SMSS Ltd. New Zealand. ----- Original Message ----- From: "Alistair George" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, June 29, 2004 9:42 AM Subject: [DUG] Pointers (again) > Last night I got out my Delphi books - you know, the decent ones that you got > when you purchased Delphi years ago. > Unfortunately, the downside of them was that the information is disbursed around > which makes following them sometimes a bit tricky. So I am still stymied. > > In the following example, can anyone see if it is in error, as there is no > memory allocation given, and may be the cause of some non-specific access > violation program errors that I was trying to fix. If wrong, example > appreciated. > > type > TPNodeData = ^TNodeData; > TNodeData = record > Index, Level, from, adds, subject, body: Integer; > FullPath, UIDL: string; > end; > > > function GetSpamLevel(from, adds, subject, body: string; Data: TPNodeData): Integer; > > > > > procedure Tmainform.VTree1InitNode(Sender: TBaseVirtualTree; ParentNode, > Node: PVirtualNode; var InitialStates: TVirtualNodeInitStates); > var Data: TPNodeData; > begin > //should I insert here: New(Data); > with Sender do > begin > Data := GetNodeData(Node); //Pointer to Node data right? > Data.Index := node.Index; //no memory allocation here. > //Here is data being placed into the pointer 'Data.Level' > Data.Level := GetSpamLevel(SakMsgList1.Items[Data.Index].From, > SakMsgList1.Items[Data.Index].Subject, '', Data); > end; > end; > > > _______________________________________________ > Delphi mailing list > [EMAIL PROTECTED] > http://ns3.123.co.nz/mailman/listinfo/delphi > _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
