How to make CEditView singleline?

Does anyone know how to make a CEditView none multiline?
I've tried using
CEditView::ModifyStyle(ES_MULTILINE | WS_VSCROLL ,0);
But it doesn't listen.
Thanks
kogg
[214 byte] By [kogg] at [2007-11-18 22:12:16]
# 1 Re: How to make CEditView singleline?
ES_MULTILINE is supposed to set it as multiline, not to disable it. Try this:

LONG dwStyle = GetWindowLong(ctrl.GetSafeHwnd(), GWL_STYLE);
dwStyle &= ~ES_MULTILINE;
SetWindowLong(ctrl.GetSafeHwnd(), GWL_STYLE, dwStyle);

But I'm not sure it works, since in MSDN at ES_MULTILINE isn't specified that "To change this style after the control has been created, use SetWindowLong." like for the other styles.
cilu at 2007-11-11 1:04:44 >
# 2 Re: How to make CEditView singleline?
LONG dwStyle = GetWindowLong(ctrl.GetSafeHwnd(), GWL_STYLE);
dwStyle &= ~ES_MULTILINE;
SetWindowLong(ctrl.GetSafeHwnd(), GWL_STYLE, dwStyle);

But I'm not sure it works, since in MSDN at ES_MULTILINE isn't specified that "To change this style after the control has been created, use SetWindowLong." like for the other styles.Yes, it won't work. :sick:
You have to destroy your old CEditView (don't forget to store its text!) and to create a new one without ES_MULTILINE style, then set the stored text in a new View.
VictorN at 2007-11-11 1:05:39 >
# 3 Re: How to make CEditView singleline?
Yep it works a treat - Thanks so much.
kogg at 2007-11-11 1:06:46 >