Kill Focus/Next Action
-
I have a situation with an edit box when the user types in an existing code, data is displayed in subsequent fields. If they type in a new number, I clear the data in the subsequent fields. The populating/clearing of the subsequent fields is triggered in the KillFocus callback of the edit box. The problem is, there are pushbuttons, like Save, Close, which now will clear the data, since moving focus out of the edit box by pressing the Close button invokes the KillFocus callback. Is there a way in the KillFocus callback to know that a press of one of the pushbuttons is in the message queue so I can process this case differently? Thanks in advance, Bob
-
I have a situation with an edit box when the user types in an existing code, data is displayed in subsequent fields. If they type in a new number, I clear the data in the subsequent fields. The populating/clearing of the subsequent fields is triggered in the KillFocus callback of the edit box. The problem is, there are pushbuttons, like Save, Close, which now will clear the data, since moving focus out of the edit box by pressing the Close button invokes the KillFocus callback. Is there a way in the KillFocus callback to know that a press of one of the pushbuttons is in the message queue so I can process this case differently? Thanks in advance, Bob
OnKillFocus
provides also theCWnd
to be given the focus. You can check whether this corresponds to one of your special buttons. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo -
OnKillFocus
provides also theCWnd
to be given the focus. You can check whether this corresponds to one of your special buttons. Joaquín M López Muñoz Telefónica, Investigación y DesarrolloI tried to do this, but I don't understand what is happening. When tabbing off of the Edit box, CWnd is a value of 12b89c, CWnd hWnd is 180bd4. If I press one of the 3 pushbuttons, the values are 12b748 and 180bd4 respectively. None of these values match the CWnd value I get returned when calling GetDlgItem(PushButtonId) for each of the pushbuttons. So how do I match the CWnd value I get in the callback with the pushbuttons? Thanks, Bob
-
I tried to do this, but I don't understand what is happening. When tabbing off of the Edit box, CWnd is a value of 12b89c, CWnd hWnd is 180bd4. If I press one of the 3 pushbuttons, the values are 12b748 and 180bd4 respectively. None of these values match the CWnd value I get returned when calling GetDlgItem(PushButtonId) for each of the pushbuttons. So how do I match the CWnd value I get in the callback with the pushbuttons? Thanks, Bob
Oh well, I've tried in a small test app, and the
CWnd
passed toOnKillFocus
seems to be that of the parent dialog. So I'm afraid this approach does not work. Sorry. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo -
Oh well, I've tried in a small test app, and the
CWnd
passed toOnKillFocus
seems to be that of the parent dialog. So I'm afraid this approach does not work. Sorry. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo -
OK, that explains what I was seeing. Is there anyway to get the ID of the control that is about to receive focus when in the OnKillFocus? Thanks, Bob
Have you tried seeing what
GetFocus(...)
andGetNextDlgTabItem(...)
return? Also, remember that if you call any functions that return aCWnd
object, likeGetFocus(...)
, you will be getting a temporaryCWnd
(actually aCTempWnd
) object unless you have already "bound" a class to the control in question. What that means that when in doubt, compare the value of them_hWnd
member to see if you have a certain control. Peace! -=- James. "Fat people are hard to kidnap." (Try Check Favorites Sometime!) -
Have you tried seeing what
GetFocus(...)
andGetNextDlgTabItem(...)
return? Also, remember that if you call any functions that return aCWnd
object, likeGetFocus(...)
, you will be getting a temporaryCWnd
(actually aCTempWnd
) object unless you have already "bound" a class to the control in question. What that means that when in doubt, compare the value of them_hWnd
member to see if you have a certain control. Peace! -=- James. "Fat people are hard to kidnap." (Try Check Favorites Sometime!)