I have 4 edit boxes on my main window created with:
I want to cycle through when the TAB button is pressed (I know how to check for keypresses and then process my actions when (wParam==VK_TAB)).Code://global declares HWND hwEB1, hwEB2, hwEB3, hwEB4; //message handler, case WM_CREATE: hwEB1=CreateWindowEx(0,"Edit","Player 1",WS_CHILD | WS_VISIBLE,15,90,60,15,hwnd,NULL,hInstMain,NULL); etc. etc. etc.
I know that to give each one focus I would use SendMessage
and pass that control's HWND and use WM_SETFOCUS. What I
don't know is how to determine which control currently has
the focus (so that I can cycle through to the next one).
I was thinking of making a class that would have 3 member variables (int iEditBox, HWND hwID and bool bHasFocus) and having an array (cebEditBoxes). Then cycling through the array and pass the hwID to the SendMessage(...,WM_SETFOCUS,...,...) and changing the bHasFocus variable. But if there is a "proper" way to do it I'd rather learn it.
Thanks in advance for your help.
Oh, yeah: I've searched the archives and the only posts that dealt with this used MFC