(27.09.2017 15:50)Valery Wrote: Nope, typing directly digits has no effect, need to hold control key in HD mod. Without HD is ok.
I tried on 4.208, few 5.0s and control key is not needed?
Anyhow, not really important.
@igrik
I tried my idea from previous post... it kind of works. It's not perfect but in the end only digits remain.
Я попробовал то, что написал в предыдущем посте... Это работает. Это не идеально, но в конце концов только цифры.
Code:
int __stdcall edit_text_proc(_Dlg_* dlg, _EventMsg_* msg)
{
int r = dlg->DefProc(msg);
if (msg->type == MT_KEYDOWN || msg->type == MT_KEYUP || msg->type == MT_MOUSEBUTTON) { // not absolutely necessary, less cpu intensive
_DlgTextEdit_ *edit = (_DlgTextEdit_*)(dlg->GetItem(55)); // id of _DlgTextEdit_
char edit_text[25]; // _DlgTextEdit_ max_len
sprintf(edit_text, edit->text); // copy _DlgTextEdit_ text
keep_digits(edit_text); // keep only '0123456789' in string (with !is_digit())
if (edit_text[0] == 0) { // strlen == 0
edit_text[0] = '0'; // put '0' as default
edit_text[1] = 0; // terminate string
}
sprintf(edit->text, edit_text); // replace _DlgTextEdit_ text
dlg->Redraw(); // redraw
}
return r;
}
EDIT:
Got it working nice and fine
Add this also when creating. Noticed it was happening with creature dialog.