Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
355
Ultra Text Editor : On Word Wrap event
posted

Hi all,

I have a multiline text editor with Word Wrap as true... As the user enters text , I want the height of the text editor to increase one two events :

1 )When the user clicks Enter , i want the height of the textbox to increase .This i am doing using the following code :

private void ultraTextEditor1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{

ultraTextEditor1.AutoSize = false;
ultraTextEditor1.Height += 20;

}
}

and it seems to do the job ..

2) When the wrap of text on a line ends and the text is written to a new line by the Word Wrap feature. I wish word wrap to be on since I don't want the user to keep typing a lot of text in horizontal line.

I am unable to latch onto any event where the New line belonging to word wrap is fired . If so , I could use the above code in the event  eg.

OnWordWrap NewLine{

ultraTextEditor1.AutoSize = false;

ultraTextEditor1.Height += 20; }

to increase text box height when charcters exceed the width of the text box.

Is there a way to do this ?

I saw that WordWrap of UltraTextEditor and TExtbox from windows have different descriptions but I assume they have the same behavior.

Instead of using TextEditor I tried this using an Ultragrid with a table with just one cell in it.  when I made the following settings , it gave me the behavior i wanted.


ultraGrid1.DisplayLayout.Bands[0].Override.RowSizing = RowSizing.AutoFree;
ultraGrid1.DisplayLayout.Bands[0].Columns[1].CellMultiLine = DefaultableBoolean.True;
ultraGrid1.DisplayLayout.Bands[0].Columns[1].AutoSizeEdit = DefaultableBoolean.True;

Can I replicate this behavior in a UltraTextEditor

  • 21795
    Offline posted

    Hello Prasaanth,

    I am just checking about the progress of this issue. Let me know if you need my further assistance on it.

    Thank you for using Infragistics Components.

  • 21795
    Offline posted

    Hello Prasaanth,

    Thank you for posting in our forum.

    There is no such property as LinesCount exposed for MS TextBox neither for Infragistics UltraTextEditor. In order to get the count of the lines of the UltraTextEditor you need to listen to some Windows messages. Please check this forum post where same issue were discussed http://ko.infragistics.com/community/forums/t/7672.aspx

    Attached I am sending you a small sample solution implementing the approach from the above mentioned discussion of our forum.

    Please let me know if this is what you are looking for or if I am missing something.

    CAS-155135-S3F8P5.zip