Click here to Skip to main content
15,913,685 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Getting input in an array... Pin
Member 190113623-Apr-05 15:24
Member 190113623-Apr-05 15:24 
Generalcin.get is creating problem Pin
Aqueel25-Apr-05 1:55
Aqueel25-Apr-05 1:55 
GeneralRe: cin.get is creating problem Pin
Member 190113625-Apr-05 2:06
Member 190113625-Apr-05 2:06 
GeneralThanks Pin
Aqueel25-Apr-05 3:50
Aqueel25-Apr-05 3:50 
GeneralWM_KILLFOCUS Pin
PeteMan_R23-Apr-05 6:55
PeteMan_R23-Apr-05 6:55 
GeneralRe: WM_KILLFOCUS Pin
Peter Ritchie23-Apr-05 8:36
Peter Ritchie23-Apr-05 8:36 
GeneralRe: WM_KILLFOCUS Pin
PJ Arends23-Apr-05 14:55
professionalPJ Arends23-Apr-05 14:55 
GeneralRe: WM_KILLFOCUS Pin
PeteMan_R23-Apr-05 15:18
PeteMan_R23-Apr-05 15:18 
I've read the article WM_KILLFOCUS is the wrong time to do field validation over and over again and I agree with it in general.

I've mentioned this to my company's design department and they said that the usablity requirements of the feature dictate that we must validate when the user tries to leave the control otherwise, then user can run into all sorts of problems in the future. I've been tempted to tell them to re-design the form so the requirement is not necessary but if the company did that, it would cost a lot of money in the form of time to not only re-design the form but to also re-code it.

What I'm currently doing now is in OnKillFocus, I'll determine that the control's data is invalid, then I'll post a WM_USER message to the form. When the form responds to the WM_USER message, it shows the appropriate messagebox and sets focus to the control. It gets messy though when the user selects a different property page. Also if the user uses an accelerator key to run the button, OnKillFocus is never called.

One idea I'm working on is to write a global catch of WM_LBUTTONDOWN and to catch accelerator key messages as well as the tab message. Then send a "CanKillFocus" message to the control that has focus and to the control's parent. If the response is false, then I would just eat the message. Then I could write a custom SetFocus method in all my controls (They all use a common template) and have it to do the same. I would just have to communicate to my programming department colleagues that they need to use new functionality to set focus to controls--especially on a form that does focus validation.

I'm currently putting together a dummy app to see if this idea would really work or if it would cause even more problems in the future.

Peteman_R
Boise, Idaho
GeneralRe: WM_KILLFOCUS Pin
Ravi Bhavnani23-Apr-05 18:24
professionalRavi Bhavnani23-Apr-05 18:24 
GeneralRe: WM_KILLFOCUS Pin
Anonymous25-Apr-05 18:07
Anonymous25-Apr-05 18:07 
GeneralPlease help me! Pin
dSolariuM23-Apr-05 4:27
dSolariuM23-Apr-05 4:27 
GeneralRe: Please help me! Pin
Ravi Bhavnani23-Apr-05 7:46
professionalRavi Bhavnani23-Apr-05 7:46 
GeneralRe: Please help me! Pin
dSolariuM24-Apr-05 5:01
dSolariuM24-Apr-05 5:01 
GeneralRe: Please help me! Pin
Ravi Bhavnani24-Apr-05 5:51
professionalRavi Bhavnani24-Apr-05 5:51 
Generaltext over image Pin
Lampros Giampouras23-Apr-05 4:06
Lampros Giampouras23-Apr-05 4:06 
Generalvirtual static Pin
Konrad Windszus23-Apr-05 3:38
Konrad Windszus23-Apr-05 3:38 
GeneralRe: virtual static Pin
Maximilien23-Apr-05 4:19
Maximilien23-Apr-05 4:19 
Generali want help in game programing Pin
medlteam23-Apr-05 3:37
medlteam23-Apr-05 3:37 
GeneralRe: i want help in game programing Pin
namaskaaram23-Apr-05 4:26
namaskaaram23-Apr-05 4:26 
Generaldisable Message Reflection of OLE Controls Pin
Anonymous23-Apr-05 2:59
Anonymous23-Apr-05 2:59 
Generalborland c++ bulider book Pin
aloktambi23-Apr-05 0:44
aloktambi23-Apr-05 0:44 
GeneralShow an Editbox Pin
fan wei fang23-Apr-05 0:09
fan wei fang23-Apr-05 0:09 
GeneralRe: Show an Editbox Pin
ThatsAlok23-Apr-05 3:03
ThatsAlok23-Apr-05 3:03 
GeneralRe: Show an Editbox Pin
fan wei fang23-Apr-05 21:34
fan wei fang23-Apr-05 21:34 
GeneralID_EDIT_PASTE - don't want some characters to be pasted. Pin
ugur_basak22-Apr-05 23:53
ugur_basak22-Apr-05 23:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.