For a long time I have struggled with MFC dialog boxes that we insert into a task panel group that has buttons on it. We use the CXTButton class and the issue I have is with the focus rectangle not drawing or with inconsistent drawing.
I have found that previously that the UISF_HIDEFOCUS flag gets cleared and so my "fix" is to try and isolate a good code location to send the WM_UPDATEUISTATE message to the button using MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS) and a 0 LPARAM. That clears the bit. This has mostly worked but now with the version 15.1.3, I am having the issue again.
So in my OnEraseBkgnd handler, I do this:
SendMessage(WM_UPDATEUISTATE, MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0);
TO make matters worse, I have previously found that on some machines, when I do that, another display is immediately initiated so I wrapped the code up to stop the display chain:
static int s_UpdatingUIState = 0;
if( 0 == s_UpdatingUIState )
{
s_UpdatingUIState = 1;
SendMessage(WM_UPDATEUISTATE, MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0);
s_UpdatingUIState = 0;
}
That was working but now it is not working. Again I am in a constant state of displays unless I remove that code.
So I searched the CJ code base we have an I see that CodeJock now has two XTButton.cpp files. One is in Controls\Deprecated\XTButton.cpp and the other in Controls\Button\XTPButton.cpp.
I set a break in both and I see that we are using the "deprecated" one. Also, in the deprecated code, I see CJ calling Inalidate(FALSE) while in the other file (non-deprecated) I see CJ calling RedrawButton.
So, I have a some questions for the CodeJock developers.
Why did you change the CXTButton:LOnUpdateUIState code to call RedrawButton when this message handler is called?
Should I be doing something to make sure I am not using the "deprecated" source file?
How might the focus rect display keep getting turned off?
|