.NET

Reply
Active Contributor
Mahersy
Posts: 39
Registered: ‎07-26-2005
Message 1 of 3 (105 Views)

Enter key behavour Multiline textbox on palette?

105 Views, 2 Replies
09-13-2006 09:32 PM
I am having trouble starting a new line with the enter key in a text box on a palette. I can load text with enters and it displays the return on the next line but when i press enter it do not return to the next line. I have set:
Multiline =True
Wordwrap = false
AcceptsTab=true
AcceptsEnter=True
*Tony Tanzillo
Message 2 of 3 (105 Views)

Re: Enter key behavour Multiline textbox on palette?

09-14-2006 09:01 PM in reply to: Mahersy
Use this control in lieu of the TextBox, and it should
solve the problem:

//////////////////////////////////////////////////////////////
using System.Windows.Forms;

namespace CaddZone.AutoCAD.UI.Controls
{

public class MultilineTextBox : System.Windows.Forms.TextBox
{
public MultilineTextBox()
: base()
{
this.Multiline = true;
}

const int DLGC_WANTCHARS = 0x0080;
const int WM_GETDLGCODE = 0x0087;

protected override void WndProc( ref Message m )
{
if( this.AcceptsReturn && m.Msg == WM_GETDLGCODE )
m.Result = new IntPtr( DLGC_WANTCHARS );
else
base.WndProc( ref m );
}
}
}


//////////////////////////////////////////////////////////////

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5328599@discussion.autodesk.com...
I am having trouble starting a new line with the enter key in a text box on a palette. I can load text with enters and it displays the return on the next line but when i press enter it do not return to the next line. I have set:
Multiline =True
Wordwrap = false
AcceptsTab=true
AcceptsEnter=True
Active Contributor
Mahersy
Posts: 39
Registered: ‎07-26-2005
Message 3 of 3 (105 Views)

Re: Enter key behavour Multiline textbox on palette?

09-17-2006 04:49 PM in reply to: Mahersy
Thank for the help.
For the c# handycaped like me

Imports System.Windows.Forms

Namespace CaddZone.AutoCAD.UI.Controls

Public Class MultilineTextBox
Inherits System.Windows.Forms.TextBox
Public Sub New()
Me.Multiline = True
End Sub

constant DLGC_WANTCHARS as Interger = &H80
constant WM_GETDLGCODE as Integer= &H87

Protected Overrides Sub WndProc(ByRef m As Message)
If Me.AcceptsReturn And m.Msg = WM_GETDLGCODE Then
m.Result = New IntPtr(DLGC_WANTCHARS)
Else
MyBase.WndProc( m)
End If
End Sub
End Class
End Namespace Message was edited by: Mahersy
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.