Way to use both EN_CHANGE and EN_KILLFOCUS
-
Is there a way to use both EN_CHANGE & EN_KILLFOCUS for edit controls(dynamic edit controls) I need to use EN_KILLFOCUS bcoz when the focus is changed from edit control to another edit control,the value entered should be validated. and now if i change a value in the edit control and try to close the application,the value should be saved!! So,the problem is that when i try to close the application,the focus changes,thus calling EN_KILLFOCUS.. So plz help me whether both can be used at the same time?
-
Is there a way to use both EN_CHANGE & EN_KILLFOCUS for edit controls(dynamic edit controls) I need to use EN_KILLFOCUS bcoz when the focus is changed from edit control to another edit control,the value entered should be validated. and now if i change a value in the edit control and try to close the application,the value should be saved!! So,the problem is that when i try to close the application,the focus changes,thus calling EN_KILLFOCUS.. So plz help me whether both can be used at the same time?
These are two different events and they are not used 'at the same time'. EN_CHANGE will be fired each time you change something in the edit (each time you press a key, it will be fired) and EN_KILLFOCUS is fired only when the control looses the focus. So, why do you see a problem there ?
-
These are two different events and they are not used 'at the same time'. EN_CHANGE will be fired each time you change something in the edit (each time you press a key, it will be fired) and EN_KILLFOCUS is fired only when the control looses the focus. So, why do you see a problem there ?
See, the problem is that when there is a change in the edit box and then if i try to close my application(Either by File->Exit or Alt+F4),both EN_CHANAGE and EN_KILLFOCUS fires. I use EN_KILLFOCUS to validate the entered text/value in edit control when there is a change focus. So when i exit my application after changing the value,it should prompt for SAVING,it does but it also handles the EN_KILLFOCUS when a invalid value is entered.
-
See, the problem is that when there is a change in the edit box and then if i try to close my application(Either by File->Exit or Alt+F4),both EN_CHANAGE and EN_KILLFOCUS fires. I use EN_KILLFOCUS to validate the entered text/value in edit control when there is a change focus. So when i exit my application after changing the value,it should prompt for SAVING,it does but it also handles the EN_KILLFOCUS when a invalid value is entered.
zxc89 wrote:
I use EN_KILLFOCUS to validate the entered text/value in edit control when there is a change focus. So when i exit my application after changing the value,it should prompt for SAVING,it does but it also handles the EN_KILLFOCUS when a invalid value is entered.
Why don't you try One Time Validation? This means validate before you save the data. Personally I don't like message boxes to come up when I press tab saying "You have to enter proper data". Lol it's very irritating. X|
Nibu thomas Software Developer Faqs by Michael dunn
-
zxc89 wrote:
I use EN_KILLFOCUS to validate the entered text/value in edit control when there is a change focus. So when i exit my application after changing the value,it should prompt for SAVING,it does but it also handles the EN_KILLFOCUS when a invalid value is entered.
Why don't you try One Time Validation? This means validate before you save the data. Personally I don't like message boxes to come up when I press tab saying "You have to enter proper data". Lol it's very irritating. X|
Nibu thomas Software Developer Faqs by Michael dunn
-
Is there a way to use both EN_CHANGE & EN_KILLFOCUS for edit controls(dynamic edit controls) I need to use EN_KILLFOCUS bcoz when the focus is changed from edit control to another edit control,the value entered should be validated. and now if i change a value in the edit control and try to close the application,the value should be saved!! So,the problem is that when i try to close the application,the focus changes,thus calling EN_KILLFOCUS.. So plz help me whether both can be used at the same time?
Don't do the validation during
EN_KILLFOCUS
. Unless the validation is time consuming, do it with eachEN_CHANGE
.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb