When the program is running, I would like to prevent
any keyboard input send to the Edit Controls.
I thought it would be easy, I have tried different approaches,
but without any luck.
Maybe they should be subclassed, but how do I manage this :confused:
Posted on 2003-03-21 00:19:33 by The SharK
1. read only style
2. subclass ur edit control to ignore input
i.e: .IF WM_CHAR
Posted on 2003-03-21 03:55:18 by wizzra
There is also EnableWindow with bEnable = FALSE.
Posted on 2003-03-21 13:10:11 by tenkey
hi wizzra and tenkey !

I have set the ES_READONLY, and subclassed the above
one, of the two Edit Controls. But there has to be input
ONCE, from the user, THEN it should be switched off.
If I subclass this control, and trap the WM_CHAR, the
user won't be able to put the numbers to the control:confused:
So a combination of letting the user type in some numbers,
then disable the keyboard typing, would do it.

if I use EnableWindow with FALSE set, then
if you hold down a button, while the program
is counting down, you'll see some flickering numbers
from that button in the Edit Control.
I don't want any typing slip inside, while the program
is running.

But how:confused: :confused: :confused:
Posted on 2003-03-21 16:58:24 by The SharK
you want only numbers in the edit control?
i think icezelion had example!
Posted on 2003-03-24 06:04:24 by wizzra
Hi wizzra

yeah, I only want the numbers in the Edit Control.
Here is my last and probably final version, so it
isn't a big deal, if one would be holding down a
button, sending some (exstra) numbers to the
Edit Control - which is counting down.

but thanks anyway:alright:
Posted on 2003-03-25 00:27:07 by The SharK
You can set the ES_NUMBER style to the edit control in order allow only numbers to be typed into the edit control... Im not exactly sure what you mean by "input
ONCE, from the user, THEN it should be switched off", but maybe you could send an EM_LIMITTEXT to the edit control and limit the text to one character?
Posted on 2003-03-25 09:28:32 by BubbaFate
Hi BubbaFate !

"Im not exactly sure what you mean by "input
ONCE, from the user, THEN it should be switched off"

If you look at the program, you have to type a number to be
counted down from. So while the program now counts, the
user could hold down a key (number) and you'll see this
number figuring INSIDE the edit control (visually).
So I thought that if I could let the user type in ONE number
to count down from, THEN shut the user off from sending anymore
numbers to the edit control - that's all.
Can you follow me ?
Posted on 2003-03-25 13:19:50 by The SharK
ok, then just send an em_setreadonly message to the edit box at the same time that you disable the 'count down!' button
Posted on 2003-03-25 21:18:47 by BubbaFate
Another way is to raise a flag (i.e. such as a byte variable which you set to 0 or 1) when you want user input and change that flag when you don't want user input.

You then trap the WM_CHAR message to your Edit control and let it go through if your flag is for user input or block it in the other case.

You may find such a method useful in other areas such as when processing the WM_CREATE or WM_INITDIALOG where you may call APIs which could send messages possibly intercepted by your callback procedures. (I learned that the hard way at one time.)

Posted on 2003-03-25 22:09:19 by Raymond
Thanks folks :alright:

I have know made the modifications using "EM_SETREADONLY"
so the project is now "finished" - well as they say "A program is
NEVER finished":grin:
Posted on 2003-03-26 17:48:08 by The SharK
There was a minor bug in the attached program, so
I have corrected it, and it should work okay now;)
Posted on 2003-03-28 15:53:24 by The SharK