就像windows资源管理器中的文件夹->重命名 一样,使当前节点进入编辑状态。

解决方案 »

  1.   

    readonly设为false,它的结点就可以编辑呀
      

  2.   

    标准的TTreeView用node.edittext就行了,可是cxTreeList的Node没有这个函数
      

  3.   

    //同上
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      if Assigned(TreeView1.Selected) and TreeView1.CanFocus then
        TreeView1.Selected.EditText;
    end;实际上是通过:TreeView_GetItemRect(Handle, ItemId, Rect, True)实现
      

  4.   

    TreeView_EditLabel(Handle, ItemId)
      

  5.   

    把树的属性readonly设为false即可以编辑
      

  6.   

    使用ApplicationEvents控件,在OnMessage事件写:procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;var Handled: Boolean);
    begin
      with TreeView1 do
       begin
         if (Msg.hwnd = Handle) and (Msg.message = WM_LBUTTONUP) then
         begin
           if (Selected.Expanded) then
             Selected.Collapse(True)
           else
             Selected.Expand(True)
         end else
        if (Msg.hwnd = Handle) and (Msg.message = WM_LBUTTONDBLCLK) then
         begin
           Handled := True;
           //添加双击代码
         end;
       end;
    end;