visual c++ - Entering newline in a cedit control -
a straightforward question....
how enter new line in cedit control box without triggering ok , closing dialog box altogether? mean when hit enter key automatically selects ok, if cursor still in cedit control. trying possible? or have use other control
ps: modal dialog box btw.
there various solutions problem.
basically need es_wantreturn
style on edit control.
another solution check message , key in pretranslatemessage (since has been commented upon not recommended way, i'm mentioning possibilities):
bool cyoudialog::pretranslatemessage(msg* pmsg) { if (pmsg->message == wm_keydown && pmsg->wparam == vk_return && getfocus() == youcontrol) { return true; } return false; }
the other solution handle wm_getdlgcode
. should subclass edit control , this:
uint cyouredit::ongetdlgcode() { return cedit::ongetdlgcode() | dlgc_wantallkeys; }
update: fyi, have @ just because you're control doesn't mean you're inside dialog box.
Comments
Post a Comment