0

When I make a dialog using CDialog project of VC++, I can not defocus any field on this dialog(CDialog). What I want to do is how some field can be defocused when I clicked the outside of this field with mouse.

Thanks for any advice and comments.

1 Answers1

0

The only obvious question: WHY? Why do you want to de-focus from a control, and (possibly) not give focus to any control? Some control within the dialog should have a keyboard focus!

You can however, make a textbox, which would be outside the visible area of dialog, and SetFocus on that control, whenever you get WM_MOUSE* message(s) on the CDialog.

Ajay
  • 18,086
  • 12
  • 59
  • 105
  • Thank you very much. In my case, I have 6 tabs which has each dialog. When I change tab and see another tab, the previous input focus is still alive. So I want to know how to defocus input field. Is this case, how can we usaully control this problem? – Jae Hun Daniel Hwang Jan 14 '13 at 19:07
  • According to the idea above, I have set focus static string like below. OnLButtonDown(nFlags, point); GetDlgItem(IDC_STATIC_LABEL)->SetFocus(); – Jae Hun Daniel Hwang Jul 03 '13 at 21:36