要实现的功能为:
 Plogdata=^Tlogdata;
  Tlogdata=record
    logtype:integer;  //记录类型
    logerror:integer;  //错误级别
    sname:string;  //服务名
    pname:string;  //进程号
    fname:string;  //函数名
    logtime:string; //日期时间
  end;将以上的数据类型存入Treeview的节点中,点击treeview的相应节点能把节点对应的数据在memo中显示出来,并且可以改变节点对应的Plogdata中的值。

解决方案 »

  1.   

    var
      p:Plogdata;
    begin
      New(p);
      TreeView1.Items.AddObject(nil,'a',p);//添加
    end;访问时
    Plogdata(TreeView1.Items[0].Data).logtype
    .
    .
    .
    也可以给Plogdata(TreeView1.Items[0].Data).logtype赋值
      

  2.   

    Memo1.Lines.Add(TreeView1.selected.text);
      

  3.   

    Delphi的例子,自己看看吧!
    The following code defines a record type of TMyRec and a record pointer type of PMyRec.type
    PMyRec = ^TMyRec;
    TMyRec = record
      FName: string;
      LName: string;
    end;Assuming these types are used, the following code adds a node to TreeView1 as the last sibling of a specified node. A TMyRec record is associated with the added item. The FName and LName fields are obtained from edit boxes Edit1 and Edit2. The Index parameter is obtained from edit box Edit3. The item is added only if the Index is a valid value.procedure TForm1.Button1Click(Sender: TObject);var
      MyRecPtr: PMyRec;
      TreeViewIndex: LongInt;
    begin
      New(MyRecPtr);
      MyRecPtr^.FName := Edit1.Text;
      MyRecPtr^.LName := Edit2.Text;
      TreeViewIndex := StrToInt(Edit3.Text);
      with TreeView1 do
      begin
        if Items.Count = 0 then
          Items.AddObject(nil, 'Item' + IntToStr(TreeViewIndex), MyRecPtr)
        else if (TreeViewIndex < Items.Count) and (TreeViewIndex >= 0) then      Items.AddObject(Items[TreeViewIndex], 'Item' + IntToStr(TreeViewIndex), MyRecPtr);
      end;
    end;After an item containing a TMyRec record has been added, the following code retrieves the FName and LName values associated with the item and displays the values in a label.procedure TForm1.Button2Click(Sender: TObject);begin
      Label1.Caption := PMyRec(TreeView1.Selected.Data)^.FName + ' ' +
                      PMyRec(TreeView1.Selected.Data)^.LName;
    end;
      

  4.   

    memo1.lines.add(plogdata(treeview1.selected.data).sname);plogdata(treeview1.selected.data).sname := '数据同步';