marisademeglio
asked on
control focus events
Hi experts,
I need to know what event gets triggered when a dialog control gets focus.
For example, my property page has several static labels, checkboxes, combo boxes, text entry fields. As the user tabs to each one I need to announce what they should do.
Can you help me?
Thanks
marisa
I need to know what event gets triggered when a dialog control gets focus.
For example, my property page has several static labels, checkboxes, combo boxes, text entry fields. As the user tabs to each one I need to announce what they should do.
Can you help me?
Thanks
marisa
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can try to trap WM_KEYDOWN with VK_TAB in PreTranslateMessage method of your CDialog derived class and then ask where's teh focus and act accordingly.
Focus can be gain/lost through mouse actions as well as through accelerator keys (i.e. keyboard shortcuts), in addition to Tab and Shift+Tab. Handling VK_TAB alone will only get you so far.
Radu
Radu
ASKER
Tab/shift-tab might work for me, since i will be playing an audio prompt as part of a self-voicing interface. which would get annoying if it were triggered by any action. but I understand Radu's point.
anyway, how would I ask "where's the focus?"
anyway, how would I ask "where's the focus?"
HWND GetFocus();
CWnd* CWnd::GetFocus(); // static
CWnd* CWnd::GetFocus(); // static
ASKER
How do I catch keyboard events in a dialog? WM_KEYUP and KEYDOWN aren't responsive..
nonubik, you mentioned PreTranslateMessage... How do I use it?
thanks
marisa
nonubik, you mentioned PreTranslateMessage... How do I use it?
thanks
marisa
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.