News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Filter input for an editbox

Started by white scorpion, June 04, 2006, 09:03:56 AM

Previous topic - Next topic

white scorpion

Hi all,

What would be the best solution to filter input for an editbox?
I want to create an editbox which can only contain hex characters.
all other characters shouldn't be added to the editbox.
I also want to disable the OK key until enough characters are put in.

My idea: Use a GetAsyncKeyState() loop and only place the hex characters in the buffer.
Then using lstrlen i could catch the input length and decide whether the ok button should be available again.

Would this be a good solution, or are there better ways to do such a thing?

Thanks,

Mark

Synfire

One of Iczelion's tutorials covers this (IIRC); subclass the edit control, ignore "illegal" characters (non-hex digits), process the rest as usual, on OK use WM_GETTEXTLENGTH to ensure the right number of characters are inputed, if so process, otherwise ignore the OK. It should be fairly easy to do.

Regards,
Bryant Keller

white scorpion

sounds easy enough.
I will check the tut's.

Thanks!