.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enter key behavour Multiline textbox on palette?

2 REPLIES 2
Reply
Message 1 of 3
mahersy
269 Views, 2 Replies

Enter key behavour Multiline textbox on palette?

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
2 REPLIES 2
Message 2 of 3
Anonymous
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
Message 3 of 3
mahersy
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost