.NET

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

Enter key behavour Multiline textbox on palette?

107 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 (107 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 (107 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!