<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: TreeView label edit in a palette in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415748#M84021</link>
    <description>Hi Tony,&lt;BR /&gt;
&lt;BR /&gt;
Works like a charm. Thanks!&lt;BR /&gt;
&lt;BR /&gt;
Scott&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4941243@discussion.autodesk.com...&lt;BR /&gt;
Fixed version:&lt;BR /&gt;
&lt;BR /&gt;
//////////////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/// DialogTreeView.cs  Cooyright (c) 2005  Tony Tanzillo  All rights &lt;BR /&gt;
reserved&lt;BR /&gt;
///&lt;BR /&gt;
/// For private use only. Do not distribute or&lt;BR /&gt;
/// publish this code without the express written&lt;BR /&gt;
/// consent of the author.&lt;BR /&gt;
///&lt;BR /&gt;
/// This TreeView descendent addresses the issue&lt;BR /&gt;
/// described in KB 130691&lt;BR /&gt;
///&lt;BR /&gt;
/// See http://support.microsoft.com/default.aspx?scid=kb;en-us;130691&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using System.Runtime.InteropServices;&lt;BR /&gt;
&lt;BR /&gt;
namespace StupidControlThunks&lt;BR /&gt;
{&lt;BR /&gt;
   public class DialogTreeView : TreeView&lt;BR /&gt;
   {&lt;BR /&gt;
      public DialogTreeView()&lt;BR /&gt;
      {&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private const int TVM_GETEDITCONTROL = 0x110F;&lt;BR /&gt;
&lt;BR /&gt;
      [DllImport("user32.dll", CharSet=CharSet.Auto)]&lt;BR /&gt;
      private static extern IntPtr SendMessage(IntPtr hWnd,&lt;BR /&gt;
         int msg, int wParam, int lParam);&lt;BR /&gt;
&lt;BR /&gt;
      private class LabelEditWindowHook : NativeWindow&lt;BR /&gt;
      {&lt;BR /&gt;
         private const int WM_GETDLGCODE = 135;&lt;BR /&gt;
         private const int DLGC_WANTALLKEYS = 0x0004;&lt;BR /&gt;
&lt;BR /&gt;
         public LabelEditWindowHook()&lt;BR /&gt;
         {&lt;BR /&gt;
         }&lt;BR /&gt;
         protected override void WndProc(ref Message m)&lt;BR /&gt;
         {&lt;BR /&gt;
            if( m.Msg == WM_GETDLGCODE )&lt;BR /&gt;
               m.Result = (IntPtr) DLGC_WANTALLKEYS;&lt;BR /&gt;
            else&lt;BR /&gt;
               base.WndProc(ref m);&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private LabelEditWindowHook m_Hook = new LabelEditWindowHook();&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnBeforeLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         base.OnBeforeLabelEdit( e );&lt;BR /&gt;
         if( ! e.CancelEdit )&lt;BR /&gt;
         {&lt;BR /&gt;
             IntPtr handle = SendMessage(this.Handle, TVM_GETEDITCONTROL, 0, &lt;BR /&gt;
0);&lt;BR /&gt;
             if( handle != IntPtr.Zero )&lt;BR /&gt;
                m_Hook.AssignHandle(handle);&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
/////// DialogTreeView.cs &lt;BR /&gt;
///////////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4941045@discussion.autodesk.com...&lt;BR /&gt;
This TreeView control descendent should solve your problem.&lt;BR /&gt;
Just use it in lieu of the Syste.Windows.Forms.TreeView.&lt;BR /&gt;
&lt;BR /&gt;
Sorry about the C#, but I don't do VB. Hopefully, somoene can&lt;BR /&gt;
translate it for you, or you can build it a separate assembly and&lt;BR /&gt;
reference it from your VB project.&lt;BR /&gt;
&lt;BR /&gt;
//////////////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/// DialogTreeView.cs  Cooyright (c) 2005  Tony Tanzillo  All rights &lt;BR /&gt;
reserved&lt;BR /&gt;
///&lt;BR /&gt;
/// For private use only. Do not distribute or&lt;BR /&gt;
/// publish this code without the express written&lt;BR /&gt;
/// consent of the author.&lt;BR /&gt;
///&lt;BR /&gt;
/// This TreeView descendent addresses the issue&lt;BR /&gt;
/// described in KB 130691&lt;BR /&gt;
///&lt;BR /&gt;
/// See http://support.microsoft.com/default.aspx?scid=kb;en-us;130691&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using System.Runtime.InteropServices;&lt;BR /&gt;
&lt;BR /&gt;
namespace StupidControlThunks&lt;BR /&gt;
{&lt;BR /&gt;
   public class DialogTreeView : TreeView&lt;BR /&gt;
   {&lt;BR /&gt;
      public DialogTreeView()&lt;BR /&gt;
      {&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private const int TVM_GETEDITCONTROL = 0x110F;&lt;BR /&gt;
&lt;BR /&gt;
      [DllImport("user32.dll", CharSet=CharSet.Auto)]&lt;BR /&gt;
      private static extern IntPtr SendMessage(IntPtr hWnd,&lt;BR /&gt;
         int msg, int wParam, int lParam);&lt;BR /&gt;
&lt;BR /&gt;
      private class LabelEditWindowHook : NativeWindow&lt;BR /&gt;
      {&lt;BR /&gt;
         private const int WM_GETDLGCODE = 135;&lt;BR /&gt;
         private const int DLGC_WANTALLKEYS = 0x0004;&lt;BR /&gt;
&lt;BR /&gt;
         public LabelEditWindowHook()&lt;BR /&gt;
         {&lt;BR /&gt;
         }&lt;BR /&gt;
         protected override void WndProc(ref Message m)&lt;BR /&gt;
         {&lt;BR /&gt;
            if( m.Msg == WM_GETDLGCODE )&lt;BR /&gt;
               m.Result = (IntPtr) DLGC_WANTALLKEYS;&lt;BR /&gt;
            else&lt;BR /&gt;
               base.WndProc(ref m);&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private LabelEditWindowHook m_Hook = new LabelEditWindowHook();&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnBeforeLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         IntPtr handle = SendMessage(this.Handle, TVM_GETEDITCONTROL, 0, 0);&lt;BR /&gt;
         if( handle != IntPtr.Zero )&lt;BR /&gt;
            m_Hook.AssignHandle(handle);&lt;BR /&gt;
         base.OnBeforeLabelEdit( e );&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnAfterLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         m_Hook.ReleaseHandle();&lt;BR /&gt;
         base.OnAfterLabelEdit( e );&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
/////// DialogTreeView.cs &lt;BR /&gt;
///////////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Scott McFarlane" &lt;SCOTT.MCFARLANE&gt; wrote in message &lt;BR /&gt;
news:4939035@discussion.autodesk.com...&lt;BR /&gt;
My .NET application creates a new PaletteSet using a user control that has a&lt;BR /&gt;
TreeView on it. The TreeView allows label editing, but once you are in label&lt;BR /&gt;
editing mode, the control does not respond to either ESC or ENTER. I seem to&lt;BR /&gt;
recall having to deal with this issue in a similar ObjectARX application,&lt;BR /&gt;
but I'm not sure how to fix it in .NET.&lt;BR /&gt;
&lt;BR /&gt;
Below is a snippet of code that demonstrates this issue:&lt;BR /&gt;
&lt;BR /&gt;
With New Autodesk.AutoCAD.Windows.PaletteSet("Test Palette")&lt;BR /&gt;
    Dim objTreeView As New System.Windows.Forms.TreeView&lt;BR /&gt;
    With objTreeView&lt;BR /&gt;
        .Dock = Windows.Forms.DockStyle.Fill&lt;BR /&gt;
        .LabelEdit = True&lt;BR /&gt;
        .Nodes.Add("Edit this node")&lt;BR /&gt;
    End With&lt;BR /&gt;
    .Add("Test Palette", objTreeView)&lt;BR /&gt;
    .Visible = True&lt;BR /&gt;
End With&lt;BR /&gt;
&lt;BR /&gt;
Any ideas?&lt;BR /&gt;
&lt;BR /&gt;
Scott&lt;/SCOTT.MCFARLANE&gt;&lt;/TONY.TANZILLO&gt;&lt;/TONY.TANZILLO&gt;</description>
    <pubDate>Mon, 29 Aug 2005 19:38:55 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-08-29T19:38:55Z</dc:date>
    <item>
      <title>TreeView label edit in a palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415739#M84012</link>
      <description>My .NET application creates a new PaletteSet using a user control that has a &lt;BR /&gt;
TreeView on it. The TreeView allows label editing, but once you are in label &lt;BR /&gt;
editing mode, the control does not respond to either ESC or ENTER. I seem to &lt;BR /&gt;
recall having to deal with this issue in a similar ObjectARX application, &lt;BR /&gt;
but I'm not sure how to fix it in .NET.&lt;BR /&gt;
&lt;BR /&gt;
Below is a snippet of code that demonstrates this issue:&lt;BR /&gt;
&lt;BR /&gt;
With New Autodesk.AutoCAD.Windows.PaletteSet("Test Palette")&lt;BR /&gt;
    Dim objTreeView As New System.Windows.Forms.TreeView&lt;BR /&gt;
    With objTreeView&lt;BR /&gt;
        .Dock = Windows.Forms.DockStyle.Fill&lt;BR /&gt;
        .LabelEdit = True&lt;BR /&gt;
        .Nodes.Add("Edit this node")&lt;BR /&gt;
    End With&lt;BR /&gt;
    .Add("Test Palette", objTreeView)&lt;BR /&gt;
    .Visible = True&lt;BR /&gt;
End With&lt;BR /&gt;
&lt;BR /&gt;
Any ideas?&lt;BR /&gt;
&lt;BR /&gt;
Scott</description>
      <pubDate>Thu, 25 Aug 2005 18:01:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415739#M84012</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-25T18:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: TreeView label edit in a palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415740#M84013</link>
      <description>I assume you have coded the node's KeyUp event to handle Enter and/or&lt;BR /&gt;
Escape?&lt;BR /&gt;
&lt;BR /&gt;
-- Mike&lt;BR /&gt;
___________________________&lt;BR /&gt;
Mike Tuersley&lt;BR /&gt;
___________________________&lt;BR /&gt;
the trick is to realize that there is no spoon...</description>
      <pubDate>Fri, 26 Aug 2005 03:35:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415740#M84013</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-26T03:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: TreeView label edit in a palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415741#M84014</link>
      <description>Oops, let me rephrase that.!  What I meant to say was have you tried&lt;BR /&gt;
throwing code into the keyup event for the treeview and the palette to see&lt;BR /&gt;
if the event registering at all one either of those keys? If not, you may&lt;BR /&gt;
need the same fix for focus as the combobox control.&lt;BR /&gt;
&lt;BR /&gt;
-- Mike&lt;BR /&gt;
___________________________&lt;BR /&gt;
Mike Tuersley&lt;BR /&gt;
___________________________&lt;BR /&gt;
the trick is to realize that there is no spoon...</description>
      <pubDate>Fri, 26 Aug 2005 13:30:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415741#M84014</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-26T13:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: TreeView label edit in a palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415742#M84015</link>
      <description>Hi Mike,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the reply. The PaletteSet and Palette classes don't appear to &lt;BR /&gt;
expose any keyboard events themselves. I tried putting some code into the &lt;BR /&gt;
TreeView's KeyUp event and found that it responds to ESC and ENTER. But when &lt;BR /&gt;
you go into label edit mode (and the TreeView control creates a temporary &lt;BR /&gt;
edit box control to edit the label) those keys seem to be ignored - in fact, &lt;BR /&gt;
the TreeView_KeyUp event is not fired at all when the label edit box is &lt;BR /&gt;
visible.&lt;BR /&gt;
&lt;BR /&gt;
- Scott&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Mike Tuersley" &lt;MTUERSLEY_NOT_&gt; wrote in message &lt;BR /&gt;
news:4939864@discussion.autodesk.com...&lt;BR /&gt;
Oops, let me rephrase that.!  What I meant to say was have you tried&lt;BR /&gt;
throwing code into the keyup event for the treeview and the palette to see&lt;BR /&gt;
if the event registering at all one either of those keys? If not, you may&lt;BR /&gt;
need the same fix for focus as the combobox control.&lt;BR /&gt;
&lt;BR /&gt;
-- Mike&lt;BR /&gt;
___________________________&lt;BR /&gt;
Mike Tuersley&lt;BR /&gt;
___________________________&lt;BR /&gt;
the trick is to realize that there is no spoon...&lt;/MTUERSLEY_NOT_&gt;</description>
      <pubDate>Fri, 26 Aug 2005 17:23:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415742#M84015</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-26T17:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: TreeView label edit in a palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415743#M84016</link>
      <description>"Mike Tuersley" &lt;MTUERSLEY_NOT_&gt; wrote:&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; If not, you may need the same fix for focus &lt;BR /&gt;
&amp;gt; as the combobox control.&lt;BR /&gt;
&lt;BR /&gt;
Hi Mike. You might be interested in knowing that&lt;BR /&gt;
the 'fix' you posted for the ComboBox problem (for&lt;BR /&gt;
not dropping down when you click on the control&lt;BR /&gt;
while the palette is floating), actually creates more &lt;BR /&gt;
problems than it solves.&lt;BR /&gt;
&lt;BR /&gt;
One of those problems is that it corrupts the behavior&lt;BR /&gt;
of any control that displays an "in-place" edit window &lt;BR /&gt;
(e.g, TreeView, ListView, DataGrid, etc.). &lt;BR /&gt;
&lt;BR /&gt;
With your fix, if you try editing a label in a treeview &lt;BR /&gt;
or listview, and you click inside the label edit window &lt;BR /&gt;
with the mouse, the label edit window looses and&lt;BR /&gt;
regains focus, with the entire label text selected.&lt;BR /&gt;
What should happen is that you should get a vertical&lt;BR /&gt;
blinking bar cursor at the point where you clicked in&lt;BR /&gt;
the control, but that doesn't happen.&lt;BR /&gt;
&lt;BR /&gt;
I haven't looked at the problem with the treeview&lt;BR /&gt;
(and it should also affect ListViews as well), so I&lt;BR /&gt;
don't know exactly what's causing it.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;/MTUERSLEY_NOT_&gt;</description>
      <pubDate>Fri, 26 Aug 2005 19:36:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415743#M84016</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-26T19:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: TreeView label edit in a palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415744#M84017</link>
      <description>Ouch! Sorry, I didn't mean for that to happen =(  Chalk another one up to&lt;BR /&gt;
"slap it in and see if it works to get me to the due date and I'll sort it&lt;BR /&gt;
out later"&lt;BR /&gt;
&lt;BR /&gt;
I'll look at it and weed out the crap and see if I can't revise it with&lt;BR /&gt;
just the focus you mentioned, Tony. Thanks!&lt;BR /&gt;
&lt;BR /&gt;
-- Mike&lt;BR /&gt;
___________________________&lt;BR /&gt;
Mike Tuersley&lt;BR /&gt;
___________________________&lt;BR /&gt;
the trick is to realize that there is no spoon...</description>
      <pubDate>Sat, 27 Aug 2005 04:47:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415744#M84017</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-27T04:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: TreeView label edit in a palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415745#M84018</link>
      <description>This TreeView control descendent should solve your problem.&lt;BR /&gt;
Just use it in lieu of the Syste.Windows.Forms.TreeView.&lt;BR /&gt;
&lt;BR /&gt;
Sorry about the C#, but I don't do VB. Hopefully, somoene can&lt;BR /&gt;
translate it for you, or you can build it a separate assembly and &lt;BR /&gt;
reference it from your VB project.&lt;BR /&gt;
&lt;BR /&gt;
//////////////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/// DialogTreeView.cs  Cooyright (c) 2005  Tony Tanzillo  All rights reserved&lt;BR /&gt;
///&lt;BR /&gt;
/// For private use only. Do not distribute or&lt;BR /&gt;
/// publish this code without the express written&lt;BR /&gt;
/// consent of the author. &lt;BR /&gt;
///&lt;BR /&gt;
/// This TreeView descendent addresses the issue&lt;BR /&gt;
/// described in KB 130691&lt;BR /&gt;
/// &lt;BR /&gt;
/// See http://support.microsoft.com/default.aspx?scid=kb;en-us;130691&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using System.Runtime.InteropServices;&lt;BR /&gt;
&lt;BR /&gt;
namespace StupidControlThunks&lt;BR /&gt;
{&lt;BR /&gt;
   public class DialogTreeView : TreeView&lt;BR /&gt;
   {&lt;BR /&gt;
      public DialogTreeView()&lt;BR /&gt;
      {&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private const int TVM_GETEDITCONTROL = 0x110F;&lt;BR /&gt;
&lt;BR /&gt;
      [DllImport("user32.dll", CharSet=CharSet.Auto)]&lt;BR /&gt;
      private static extern IntPtr SendMessage(IntPtr hWnd, &lt;BR /&gt;
         int msg, int wParam, int lParam);&lt;BR /&gt;
&lt;BR /&gt;
      private class LabelEditWindowHook : NativeWindow&lt;BR /&gt;
      {&lt;BR /&gt;
         private const int WM_GETDLGCODE = 135;&lt;BR /&gt;
         private const int DLGC_WANTALLKEYS = 0x0004;&lt;BR /&gt;
&lt;BR /&gt;
         public LabelEditWindowHook()&lt;BR /&gt;
         {&lt;BR /&gt;
         }&lt;BR /&gt;
         protected override void WndProc(ref Message m)&lt;BR /&gt;
         {&lt;BR /&gt;
            if( m.Msg == WM_GETDLGCODE )&lt;BR /&gt;
               m.Result = (IntPtr) DLGC_WANTALLKEYS;&lt;BR /&gt;
            else&lt;BR /&gt;
               base.WndProc(ref m);&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
      &lt;BR /&gt;
      private LabelEditWindowHook m_Hook = new LabelEditWindowHook();&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnBeforeLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         IntPtr handle = SendMessage(this.Handle, TVM_GETEDITCONTROL, 0, 0);&lt;BR /&gt;
         if( handle != IntPtr.Zero )&lt;BR /&gt;
            m_Hook.AssignHandle(handle);&lt;BR /&gt;
         base.OnBeforeLabelEdit( e );&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnAfterLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         m_Hook.ReleaseHandle();&lt;BR /&gt;
         base.OnAfterLabelEdit( e );&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
/////// DialogTreeView.cs ///////////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Scott McFarlane" &lt;SCOTT.MCFARLANE&gt; wrote in message news:4939035@discussion.autodesk.com...&lt;BR /&gt;
My .NET application creates a new PaletteSet using a user control that has a &lt;BR /&gt;
TreeView on it. The TreeView allows label editing, but once you are in label &lt;BR /&gt;
editing mode, the control does not respond to either ESC or ENTER. I seem to &lt;BR /&gt;
recall having to deal with this issue in a similar ObjectARX application, &lt;BR /&gt;
but I'm not sure how to fix it in .NET.&lt;BR /&gt;
&lt;BR /&gt;
Below is a snippet of code that demonstrates this issue:&lt;BR /&gt;
&lt;BR /&gt;
With New Autodesk.AutoCAD.Windows.PaletteSet("Test Palette")&lt;BR /&gt;
    Dim objTreeView As New System.Windows.Forms.TreeView&lt;BR /&gt;
    With objTreeView&lt;BR /&gt;
        .Dock = Windows.Forms.DockStyle.Fill&lt;BR /&gt;
        .LabelEdit = True&lt;BR /&gt;
        .Nodes.Add("Edit this node")&lt;BR /&gt;
    End With&lt;BR /&gt;
    .Add("Test Palette", objTreeView)&lt;BR /&gt;
    .Visible = True&lt;BR /&gt;
End With&lt;BR /&gt;
&lt;BR /&gt;
Any ideas?&lt;BR /&gt;
&lt;BR /&gt;
Scott&lt;/SCOTT.MCFARLANE&gt;</description>
      <pubDate>Sun, 28 Aug 2005 05:45:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415745#M84018</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-28T05:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: TreeView label edit in a palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415746#M84019</link>
      <description>Fixed version:&lt;BR /&gt;
&lt;BR /&gt;
//////////////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/// DialogTreeView.cs  Cooyright (c) 2005  Tony Tanzillo  All rights reserved&lt;BR /&gt;
///&lt;BR /&gt;
/// For private use only. Do not distribute or&lt;BR /&gt;
/// publish this code without the express written&lt;BR /&gt;
/// consent of the author. &lt;BR /&gt;
///&lt;BR /&gt;
/// This TreeView descendent addresses the issue&lt;BR /&gt;
/// described in KB 130691&lt;BR /&gt;
/// &lt;BR /&gt;
/// See http://support.microsoft.com/default.aspx?scid=kb;en-us;130691&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using System.Runtime.InteropServices;&lt;BR /&gt;
&lt;BR /&gt;
namespace StupidControlThunks&lt;BR /&gt;
{&lt;BR /&gt;
   public class DialogTreeView : TreeView&lt;BR /&gt;
   {&lt;BR /&gt;
      public DialogTreeView()&lt;BR /&gt;
      {&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private const int TVM_GETEDITCONTROL = 0x110F;&lt;BR /&gt;
&lt;BR /&gt;
      [DllImport("user32.dll", CharSet=CharSet.Auto)]&lt;BR /&gt;
      private static extern IntPtr SendMessage(IntPtr hWnd, &lt;BR /&gt;
         int msg, int wParam, int lParam);&lt;BR /&gt;
&lt;BR /&gt;
      private class LabelEditWindowHook : NativeWindow&lt;BR /&gt;
      {&lt;BR /&gt;
         private const int WM_GETDLGCODE = 135;&lt;BR /&gt;
         private const int DLGC_WANTALLKEYS = 0x0004;&lt;BR /&gt;
&lt;BR /&gt;
         public LabelEditWindowHook()&lt;BR /&gt;
         {&lt;BR /&gt;
         }&lt;BR /&gt;
         protected override void WndProc(ref Message m)&lt;BR /&gt;
         {&lt;BR /&gt;
            if( m.Msg == WM_GETDLGCODE )&lt;BR /&gt;
               m.Result = (IntPtr) DLGC_WANTALLKEYS;&lt;BR /&gt;
            else&lt;BR /&gt;
               base.WndProc(ref m);&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
      &lt;BR /&gt;
      private LabelEditWindowHook m_Hook = new LabelEditWindowHook();&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnBeforeLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         base.OnBeforeLabelEdit( e );&lt;BR /&gt;
         if( ! e.CancelEdit )&lt;BR /&gt;
         {&lt;BR /&gt;
             IntPtr handle = SendMessage(this.Handle, TVM_GETEDITCONTROL, 0, 0);&lt;BR /&gt;
             if( handle != IntPtr.Zero )&lt;BR /&gt;
                m_Hook.AssignHandle(handle);&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
/////// DialogTreeView.cs ///////////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message news:4941045@discussion.autodesk.com...&lt;BR /&gt;
This TreeView control descendent should solve your problem.&lt;BR /&gt;
Just use it in lieu of the Syste.Windows.Forms.TreeView.&lt;BR /&gt;
&lt;BR /&gt;
Sorry about the C#, but I don't do VB. Hopefully, somoene can&lt;BR /&gt;
translate it for you, or you can build it a separate assembly and &lt;BR /&gt;
reference it from your VB project.&lt;BR /&gt;
&lt;BR /&gt;
//////////////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/// DialogTreeView.cs  Cooyright (c) 2005  Tony Tanzillo  All rights reserved&lt;BR /&gt;
///&lt;BR /&gt;
/// For private use only. Do not distribute or&lt;BR /&gt;
/// publish this code without the express written&lt;BR /&gt;
/// consent of the author. &lt;BR /&gt;
///&lt;BR /&gt;
/// This TreeView descendent addresses the issue&lt;BR /&gt;
/// described in KB 130691&lt;BR /&gt;
/// &lt;BR /&gt;
/// See http://support.microsoft.com/default.aspx?scid=kb;en-us;130691&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using System.Runtime.InteropServices;&lt;BR /&gt;
&lt;BR /&gt;
namespace StupidControlThunks&lt;BR /&gt;
{&lt;BR /&gt;
   public class DialogTreeView : TreeView&lt;BR /&gt;
   {&lt;BR /&gt;
      public DialogTreeView()&lt;BR /&gt;
      {&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private const int TVM_GETEDITCONTROL = 0x110F;&lt;BR /&gt;
&lt;BR /&gt;
      [DllImport("user32.dll", CharSet=CharSet.Auto)]&lt;BR /&gt;
      private static extern IntPtr SendMessage(IntPtr hWnd, &lt;BR /&gt;
         int msg, int wParam, int lParam);&lt;BR /&gt;
&lt;BR /&gt;
      private class LabelEditWindowHook : NativeWindow&lt;BR /&gt;
      {&lt;BR /&gt;
         private const int WM_GETDLGCODE = 135;&lt;BR /&gt;
         private const int DLGC_WANTALLKEYS = 0x0004;&lt;BR /&gt;
&lt;BR /&gt;
         public LabelEditWindowHook()&lt;BR /&gt;
         {&lt;BR /&gt;
         }&lt;BR /&gt;
         protected override void WndProc(ref Message m)&lt;BR /&gt;
         {&lt;BR /&gt;
            if( m.Msg == WM_GETDLGCODE )&lt;BR /&gt;
               m.Result = (IntPtr) DLGC_WANTALLKEYS;&lt;BR /&gt;
            else&lt;BR /&gt;
               base.WndProc(ref m);&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
      &lt;BR /&gt;
      private LabelEditWindowHook m_Hook = new LabelEditWindowHook();&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnBeforeLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         IntPtr handle = SendMessage(this.Handle, TVM_GETEDITCONTROL, 0, 0);&lt;BR /&gt;
         if( handle != IntPtr.Zero )&lt;BR /&gt;
            m_Hook.AssignHandle(handle);&lt;BR /&gt;
         base.OnBeforeLabelEdit( e );&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnAfterLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         m_Hook.ReleaseHandle();&lt;BR /&gt;
         base.OnAfterLabelEdit( e );&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
/////// DialogTreeView.cs ///////////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Scott McFarlane" &lt;SCOTT.MCFARLANE&gt; wrote in message news:4939035@discussion.autodesk.com...&lt;BR /&gt;
My .NET application creates a new PaletteSet using a user control that has a &lt;BR /&gt;
TreeView on it. The TreeView allows label editing, but once you are in label &lt;BR /&gt;
editing mode, the control does not respond to either ESC or ENTER. I seem to &lt;BR /&gt;
recall having to deal with this issue in a similar ObjectARX application, &lt;BR /&gt;
but I'm not sure how to fix it in .NET.&lt;BR /&gt;
&lt;BR /&gt;
Below is a snippet of code that demonstrates this issue:&lt;BR /&gt;
&lt;BR /&gt;
With New Autodesk.AutoCAD.Windows.PaletteSet("Test Palette")&lt;BR /&gt;
    Dim objTreeView As New System.Windows.Forms.TreeView&lt;BR /&gt;
    With objTreeView&lt;BR /&gt;
        .Dock = Windows.Forms.DockStyle.Fill&lt;BR /&gt;
        .LabelEdit = True&lt;BR /&gt;
        .Nodes.Add("Edit this node")&lt;BR /&gt;
    End With&lt;BR /&gt;
    .Add("Test Palette", objTreeView)&lt;BR /&gt;
    .Visible = True&lt;BR /&gt;
End With&lt;BR /&gt;
&lt;BR /&gt;
Any ideas?&lt;BR /&gt;
&lt;BR /&gt;
Scott&lt;/SCOTT.MCFARLANE&gt;&lt;/TONY.TANZILLO&gt;</description>
      <pubDate>Mon, 29 Aug 2005 05:00:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415746#M84019</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-29T05:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: TreeView label edit in a palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415747#M84020</link>
      <description>The code below has a major bug. Don't use it.&lt;BR /&gt;
&lt;BR /&gt;
See the next post for a fixed version.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message news:4941045@discussion.autodesk.com...&lt;BR /&gt;
This TreeView control descendent should solve your problem.&lt;BR /&gt;
Just use it in lieu of the Syste.Windows.Forms.TreeView.&lt;BR /&gt;
&lt;BR /&gt;
Sorry about the C#, but I don't do VB. Hopefully, somoene can&lt;BR /&gt;
translate it for you, or you can build it a separate assembly and &lt;BR /&gt;
reference it from your VB project.&lt;BR /&gt;
&lt;BR /&gt;
//////////////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/// DialogTreeView.cs  Cooyright (c) 2005  Tony Tanzillo  All rights reserved&lt;BR /&gt;
///&lt;BR /&gt;
/// For private use only. Do not distribute or&lt;BR /&gt;
/// publish this code without the express written&lt;BR /&gt;
/// consent of the author. &lt;BR /&gt;
///&lt;BR /&gt;
/// This TreeView descendent addresses the issue&lt;BR /&gt;
/// described in KB 130691&lt;BR /&gt;
/// &lt;BR /&gt;
/// See http://support.microsoft.com/default.aspx?scid=kb;en-us;130691&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using System.Runtime.InteropServices;&lt;BR /&gt;
&lt;BR /&gt;
namespace StupidControlThunks&lt;BR /&gt;
{&lt;BR /&gt;
   public class DialogTreeView : TreeView&lt;BR /&gt;
   {&lt;BR /&gt;
      public DialogTreeView()&lt;BR /&gt;
      {&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private const int TVM_GETEDITCONTROL = 0x110F;&lt;BR /&gt;
&lt;BR /&gt;
      [DllImport("user32.dll", CharSet=CharSet.Auto)]&lt;BR /&gt;
      private static extern IntPtr SendMessage(IntPtr hWnd, &lt;BR /&gt;
         int msg, int wParam, int lParam);&lt;BR /&gt;
&lt;BR /&gt;
      private class LabelEditWindowHook : NativeWindow&lt;BR /&gt;
      {&lt;BR /&gt;
         private const int WM_GETDLGCODE = 135;&lt;BR /&gt;
         private const int DLGC_WANTALLKEYS = 0x0004;&lt;BR /&gt;
&lt;BR /&gt;
         public LabelEditWindowHook()&lt;BR /&gt;
         {&lt;BR /&gt;
         }&lt;BR /&gt;
         protected override void WndProc(ref Message m)&lt;BR /&gt;
         {&lt;BR /&gt;
            if( m.Msg == WM_GETDLGCODE )&lt;BR /&gt;
               m.Result = (IntPtr) DLGC_WANTALLKEYS;&lt;BR /&gt;
            else&lt;BR /&gt;
               base.WndProc(ref m);&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
      &lt;BR /&gt;
      private LabelEditWindowHook m_Hook = new LabelEditWindowHook();&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnBeforeLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         IntPtr handle = SendMessage(this.Handle, TVM_GETEDITCONTROL, 0, 0);&lt;BR /&gt;
         if( handle != IntPtr.Zero )&lt;BR /&gt;
            m_Hook.AssignHandle(handle);&lt;BR /&gt;
         base.OnBeforeLabelEdit( e );&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnAfterLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         m_Hook.ReleaseHandle();&lt;BR /&gt;
         base.OnAfterLabelEdit( e );&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
/////// DialogTreeView.cs ///////////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Scott McFarlane" &lt;SCOTT.MCFARLANE&gt; wrote in message news:4939035@discussion.autodesk.com...&lt;BR /&gt;
My .NET application creates a new PaletteSet using a user control that has a &lt;BR /&gt;
TreeView on it. The TreeView allows label editing, but once you are in label &lt;BR /&gt;
editing mode, the control does not respond to either ESC or ENTER. I seem to &lt;BR /&gt;
recall having to deal with this issue in a similar ObjectARX application, &lt;BR /&gt;
but I'm not sure how to fix it in .NET.&lt;BR /&gt;
&lt;BR /&gt;
Below is a snippet of code that demonstrates this issue:&lt;BR /&gt;
&lt;BR /&gt;
With New Autodesk.AutoCAD.Windows.PaletteSet("Test Palette")&lt;BR /&gt;
    Dim objTreeView As New System.Windows.Forms.TreeView&lt;BR /&gt;
    With objTreeView&lt;BR /&gt;
        .Dock = Windows.Forms.DockStyle.Fill&lt;BR /&gt;
        .LabelEdit = True&lt;BR /&gt;
        .Nodes.Add("Edit this node")&lt;BR /&gt;
    End With&lt;BR /&gt;
    .Add("Test Palette", objTreeView)&lt;BR /&gt;
    .Visible = True&lt;BR /&gt;
End With&lt;BR /&gt;
&lt;BR /&gt;
Any ideas?&lt;BR /&gt;
&lt;BR /&gt;
Scott&lt;/SCOTT.MCFARLANE&gt;&lt;/TONY.TANZILLO&gt;</description>
      <pubDate>Mon, 29 Aug 2005 17:01:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415747#M84020</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-29T17:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: TreeView label edit in a palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415748#M84021</link>
      <description>Hi Tony,&lt;BR /&gt;
&lt;BR /&gt;
Works like a charm. Thanks!&lt;BR /&gt;
&lt;BR /&gt;
Scott&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4941243@discussion.autodesk.com...&lt;BR /&gt;
Fixed version:&lt;BR /&gt;
&lt;BR /&gt;
//////////////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/// DialogTreeView.cs  Cooyright (c) 2005  Tony Tanzillo  All rights &lt;BR /&gt;
reserved&lt;BR /&gt;
///&lt;BR /&gt;
/// For private use only. Do not distribute or&lt;BR /&gt;
/// publish this code without the express written&lt;BR /&gt;
/// consent of the author.&lt;BR /&gt;
///&lt;BR /&gt;
/// This TreeView descendent addresses the issue&lt;BR /&gt;
/// described in KB 130691&lt;BR /&gt;
///&lt;BR /&gt;
/// See http://support.microsoft.com/default.aspx?scid=kb;en-us;130691&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using System.Runtime.InteropServices;&lt;BR /&gt;
&lt;BR /&gt;
namespace StupidControlThunks&lt;BR /&gt;
{&lt;BR /&gt;
   public class DialogTreeView : TreeView&lt;BR /&gt;
   {&lt;BR /&gt;
      public DialogTreeView()&lt;BR /&gt;
      {&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private const int TVM_GETEDITCONTROL = 0x110F;&lt;BR /&gt;
&lt;BR /&gt;
      [DllImport("user32.dll", CharSet=CharSet.Auto)]&lt;BR /&gt;
      private static extern IntPtr SendMessage(IntPtr hWnd,&lt;BR /&gt;
         int msg, int wParam, int lParam);&lt;BR /&gt;
&lt;BR /&gt;
      private class LabelEditWindowHook : NativeWindow&lt;BR /&gt;
      {&lt;BR /&gt;
         private const int WM_GETDLGCODE = 135;&lt;BR /&gt;
         private const int DLGC_WANTALLKEYS = 0x0004;&lt;BR /&gt;
&lt;BR /&gt;
         public LabelEditWindowHook()&lt;BR /&gt;
         {&lt;BR /&gt;
         }&lt;BR /&gt;
         protected override void WndProc(ref Message m)&lt;BR /&gt;
         {&lt;BR /&gt;
            if( m.Msg == WM_GETDLGCODE )&lt;BR /&gt;
               m.Result = (IntPtr) DLGC_WANTALLKEYS;&lt;BR /&gt;
            else&lt;BR /&gt;
               base.WndProc(ref m);&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private LabelEditWindowHook m_Hook = new LabelEditWindowHook();&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnBeforeLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         base.OnBeforeLabelEdit( e );&lt;BR /&gt;
         if( ! e.CancelEdit )&lt;BR /&gt;
         {&lt;BR /&gt;
             IntPtr handle = SendMessage(this.Handle, TVM_GETEDITCONTROL, 0, &lt;BR /&gt;
0);&lt;BR /&gt;
             if( handle != IntPtr.Zero )&lt;BR /&gt;
                m_Hook.AssignHandle(handle);&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
/////// DialogTreeView.cs &lt;BR /&gt;
///////////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4941045@discussion.autodesk.com...&lt;BR /&gt;
This TreeView control descendent should solve your problem.&lt;BR /&gt;
Just use it in lieu of the Syste.Windows.Forms.TreeView.&lt;BR /&gt;
&lt;BR /&gt;
Sorry about the C#, but I don't do VB. Hopefully, somoene can&lt;BR /&gt;
translate it for you, or you can build it a separate assembly and&lt;BR /&gt;
reference it from your VB project.&lt;BR /&gt;
&lt;BR /&gt;
//////////////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/// DialogTreeView.cs  Cooyright (c) 2005  Tony Tanzillo  All rights &lt;BR /&gt;
reserved&lt;BR /&gt;
///&lt;BR /&gt;
/// For private use only. Do not distribute or&lt;BR /&gt;
/// publish this code without the express written&lt;BR /&gt;
/// consent of the author.&lt;BR /&gt;
///&lt;BR /&gt;
/// This TreeView descendent addresses the issue&lt;BR /&gt;
/// described in KB 130691&lt;BR /&gt;
///&lt;BR /&gt;
/// See http://support.microsoft.com/default.aspx?scid=kb;en-us;130691&lt;BR /&gt;
&lt;BR /&gt;
using System;&lt;BR /&gt;
using System.Windows.Forms;&lt;BR /&gt;
using System.Runtime.InteropServices;&lt;BR /&gt;
&lt;BR /&gt;
namespace StupidControlThunks&lt;BR /&gt;
{&lt;BR /&gt;
   public class DialogTreeView : TreeView&lt;BR /&gt;
   {&lt;BR /&gt;
      public DialogTreeView()&lt;BR /&gt;
      {&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private const int TVM_GETEDITCONTROL = 0x110F;&lt;BR /&gt;
&lt;BR /&gt;
      [DllImport("user32.dll", CharSet=CharSet.Auto)]&lt;BR /&gt;
      private static extern IntPtr SendMessage(IntPtr hWnd,&lt;BR /&gt;
         int msg, int wParam, int lParam);&lt;BR /&gt;
&lt;BR /&gt;
      private class LabelEditWindowHook : NativeWindow&lt;BR /&gt;
      {&lt;BR /&gt;
         private const int WM_GETDLGCODE = 135;&lt;BR /&gt;
         private const int DLGC_WANTALLKEYS = 0x0004;&lt;BR /&gt;
&lt;BR /&gt;
         public LabelEditWindowHook()&lt;BR /&gt;
         {&lt;BR /&gt;
         }&lt;BR /&gt;
         protected override void WndProc(ref Message m)&lt;BR /&gt;
         {&lt;BR /&gt;
            if( m.Msg == WM_GETDLGCODE )&lt;BR /&gt;
               m.Result = (IntPtr) DLGC_WANTALLKEYS;&lt;BR /&gt;
            else&lt;BR /&gt;
               base.WndProc(ref m);&lt;BR /&gt;
         }&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      private LabelEditWindowHook m_Hook = new LabelEditWindowHook();&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnBeforeLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         IntPtr handle = SendMessage(this.Handle, TVM_GETEDITCONTROL, 0, 0);&lt;BR /&gt;
         if( handle != IntPtr.Zero )&lt;BR /&gt;
            m_Hook.AssignHandle(handle);&lt;BR /&gt;
         base.OnBeforeLabelEdit( e );&lt;BR /&gt;
      }&lt;BR /&gt;
&lt;BR /&gt;
      protected override void OnAfterLabelEdit( NodeLabelEditEventArgs e )&lt;BR /&gt;
      {&lt;BR /&gt;
         m_Hook.ReleaseHandle();&lt;BR /&gt;
         base.OnAfterLabelEdit( e );&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
/////// DialogTreeView.cs &lt;BR /&gt;
///////////////////////////////////////////////////&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Scott McFarlane" &lt;SCOTT.MCFARLANE&gt; wrote in message &lt;BR /&gt;
news:4939035@discussion.autodesk.com...&lt;BR /&gt;
My .NET application creates a new PaletteSet using a user control that has a&lt;BR /&gt;
TreeView on it. The TreeView allows label editing, but once you are in label&lt;BR /&gt;
editing mode, the control does not respond to either ESC or ENTER. I seem to&lt;BR /&gt;
recall having to deal with this issue in a similar ObjectARX application,&lt;BR /&gt;
but I'm not sure how to fix it in .NET.&lt;BR /&gt;
&lt;BR /&gt;
Below is a snippet of code that demonstrates this issue:&lt;BR /&gt;
&lt;BR /&gt;
With New Autodesk.AutoCAD.Windows.PaletteSet("Test Palette")&lt;BR /&gt;
    Dim objTreeView As New System.Windows.Forms.TreeView&lt;BR /&gt;
    With objTreeView&lt;BR /&gt;
        .Dock = Windows.Forms.DockStyle.Fill&lt;BR /&gt;
        .LabelEdit = True&lt;BR /&gt;
        .Nodes.Add("Edit this node")&lt;BR /&gt;
    End With&lt;BR /&gt;
    .Add("Test Palette", objTreeView)&lt;BR /&gt;
    .Visible = True&lt;BR /&gt;
End With&lt;BR /&gt;
&lt;BR /&gt;
Any ideas?&lt;BR /&gt;
&lt;BR /&gt;
Scott&lt;/SCOTT.MCFARLANE&gt;&lt;/TONY.TANZILLO&gt;&lt;/TONY.TANZILLO&gt;</description>
      <pubDate>Mon, 29 Aug 2005 19:38:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415748#M84021</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-29T19:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: TreeView label edit in a palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415749#M84022</link>
      <description>You may want to fix that "cooyright" too. ;^)&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
R. Robert Bell&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4941709@discussion.autodesk.com...&lt;BR /&gt;
The code below has a major bug. Don't use it.&lt;BR /&gt;
&lt;BR /&gt;
See the next post for a fixed version.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4941045@discussion.autodesk.com...&lt;BR /&gt;
This TreeView control descendent should solve your problem.&lt;BR /&gt;
Just use it in lieu of the Syste.Windows.Forms.TreeView.&lt;BR /&gt;
&lt;BR /&gt;
Sorry about the C#, but I don't do VB. Hopefully, somoene can&lt;BR /&gt;
translate it for you, or you can build it a separate assembly and&lt;BR /&gt;
reference it from your VB project.&lt;BR /&gt;
&lt;BR /&gt;
//////////////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/// DialogTreeView.cs  Cooyright (c) 2005  Tony Tanzillo  All rights &lt;BR /&gt;
reserved&lt;BR /&gt;
///&lt;BR /&gt;
/// For private use only. Do not distribute or&lt;BR /&gt;
/// publish this code without the express written&lt;/TONY.TANZILLO&gt;&lt;/TONY.TANZILLO&gt;</description>
      <pubDate>Mon, 29 Aug 2005 22:00:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415749#M84022</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-29T22:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: TreeView label edit in a palette</title>
      <link>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415750#M84023</link>
      <description>Well, at least you were able to see that flaw,&lt;BR /&gt;
if nothing else.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"R. Robert Bell" &lt;NOT.ROBERTB&gt; wrote in message news:4942183@discussion.autodesk.com...&lt;BR /&gt;
You may want to fix that "cooyright" too. ;^)&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
R. Robert Bell&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4941709@discussion.autodesk.com...&lt;BR /&gt;
The code below has a major bug. Don't use it.&lt;BR /&gt;
&lt;BR /&gt;
See the next post for a fixed version.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"Tony Tanzillo" &lt;TONY.TANZILLO&gt; wrote in message &lt;BR /&gt;
news:4941045@discussion.autodesk.com...&lt;BR /&gt;
This TreeView control descendent should solve your problem.&lt;BR /&gt;
Just use it in lieu of the Syste.Windows.Forms.TreeView.&lt;BR /&gt;
&lt;BR /&gt;
Sorry about the C#, but I don't do VB. Hopefully, somoene can&lt;BR /&gt;
translate it for you, or you can build it a separate assembly and&lt;BR /&gt;
reference it from your VB project.&lt;BR /&gt;
&lt;BR /&gt;
//////////////////////////////////////////////////////////////////////////////////////&lt;BR /&gt;
/// DialogTreeView.cs  Cooyright (c) 2005  Tony Tanzillo  All rights &lt;BR /&gt;
reserved&lt;BR /&gt;
///&lt;BR /&gt;
/// For private use only. Do not distribute or&lt;BR /&gt;
/// publish this code without the express written&lt;/TONY.TANZILLO&gt;&lt;/TONY.TANZILLO&gt;&lt;/NOT.ROBERTB&gt;</description>
      <pubDate>Tue, 30 Aug 2005 05:11:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/treeview-label-edit-in-a-palette/m-p/1415750#M84023</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-30T05:11:30Z</dc:date>
    </item>
  </channel>
</rss>

