Click to See Complete Forum and Search --> : edit field unlimited chars?


vivendi
March 6th, 2006, 04:55 AM
Hello, i've created an edit field, but it can't contain an unlimited amount of chars. The width of the edit field is the max number of chars, how can i make this go away so that it can contain as many chars as i want?

jayender.vs
March 6th, 2006, 05:03 AM
Hello, i've created an edit field, but it can't contain an unlimited amount of chars. The width of the edit field is the max number of chars, how can i make this go away so that it can contain as many chars as i want?
how about using Multiline Edit Control ....

Bornish
March 6th, 2006, 05:04 AM
In this sample, the bold line makes the edit control to use unlimited memory for the text that can be contained by the control: CEdit::Create(
WS_CHILD|WS_VISIBLE|WS_TABSTOP
|ES_AUTOHSCROLL|ES_AUTOVSCROLL
|ES_LEFT
|(isMultiline?ES_WANTRETURN|ES_MULTILINE/*|WS_HSCROLL*/|WS_VSCROLL:0)
,rcCtl,pParent,IDC_EDIT_BOX + (++count));
CEdit::SetLimitText(0);Regards,

vivendi
March 6th, 2006, 05:07 AM
Without MFC code please...

Bornish
March 6th, 2006, 05:11 AM
how about using Multiline Edit Control ....
That won't solve his problem... since Multiline Edit control will also limit the buffer size by default.

@vivendi: Another way of changing the behaviour of the control, using only APIs (no MFC derived class), would be to send EM_SETLIMITTEXT message to the control (using SendMessage API). Give both wParam & lParam as 0 (zero) in order to disable max_characters check.

Regards,

ovidiucucu
March 6th, 2006, 05:30 AM
[ Moved thread ]

Well, everything has a limit.
The max limit that can be set (by passing zero in wParam when sending EM_SETLIMITTEXT/EM_LIMITTEXT message) depends on edit type (single or multiline) and the operating system

Windows 95/98

0x7FFE for single line edit control
0xFFFF for multiline edit control

Windows NT/2000/XP

0x7FFFFFFE for single line edit control
0xFFFFFFFF for multiline edit control


If you want to step beyond these limits use rich edit control.

kkez
March 6th, 2006, 09:50 AM
Hello, i've created an edit field, but it can't contain an unlimited amount of chars. The width of the edit field is the max number of chars, how can i make this go away so that it can contain as many chars as i want?

Just use the ES_AUTOHSCROLL style.