My first question has to do with giving(forcing) a window focus, so that I can handle WM_MOUSEWHEEL messages.
I currently have a CGXGridWnd inside of a CDlgPage, im my gridwnd I have a messge handler that will receive WM_MOUSEWHEEL messages and scroll the list accordingly, this works fine until I click on of the four CxShadeButtons on the screen(CDlgPage) which takes focus from my gridwnd (i think), so then after the button is done doing what it does I cannot keep scrolling as I wish.
I came to this conclusion because I placed this code block inside two functions,
CWnd *pWnd = this->GetFocus();
if(pWnd->GetSafeHwnd() != this->GetSafeHwnd())
TRACE("NOT IN FOCUS\n");
I placed this inside my message handler inside the CGXGridWnd class, also in the function called when a button is pressed on the CDlgPage (on this page it is modified to find the Focus of my grid window, so read m_GridWnd. instead of this->)
So, when a button is pressed I get the TRACE statement, which means the grid is not in focus, and the call I make to GetFocus does not give the gridwnd focus.
So I guess my overall question is, first should I be forcing focus on the gridwnd for what I want to happen to happen, and if so how do I force focus on a window?
Thanks in advance,
Just to add, When using Spy++ I could not find where AT ALL the WM_MOUSEWHEEL messages were being sent after a button is pressed. I was watching the GridWnd, the button, the CDlgPage, and the entire application window. I mean it to me looks like I don't even have a mousewheel. The messages only start to come up again after I physically use my mouse and click on something in the GridWnd.
In the function that is called on my CDlgPage when a button is pressed I put the line m_GridWnd.SendMessage(WM_PASTE, 0, 0) and try to paste nothing so I can get focus. This does not work either, it seems only a click will get focus to the list
If I place the following code into the CDlgPage function that is called when the button is pressed, placed right at the end of the function
Ok, I think I have fixed my problem after some searching and guess and check coding.
It seems that in most (if not all) of my CheckEnables functions (checks the dialog page to see if controls need to be enabled or disabled based on current program data) violate this webpage and the bug it details
But is just a excel type custom grid control we use to display info about each step in a program to users. Here the user can move, delete, copy, and add steps using 4 buttons at the bottom of the dialog page containing the CxGridWnd control.