I have an menu option that has 2 radio buttons when I select either one I want it to redraw the client area, but it doesn't until I resize the window.
I've listed what I believe to be the relevant code below. I am assuming that I have made some simple error in my dialog callback!
Code:
case WM_SIZE:
cxClient = LOWORD (lParam);
cyClient = HIWORD (lParam);
// return 0; Want it to fall thru...
case WM_PAINT: // The window needs to be redrawn.
{
hdc = BeginPaint (hwnd, &ps) ;
SetMapMode(hdc, MM_TWIPS);
///////////////////////////////////////
// Begin centering output on screen. //
// Lots of stuff here...
if(bDisplayCoords) // check buttons in Menu Options.
{
///// do stuff //////
}
EndPaint (hwnd, &ps) ;
return 0 ;
}
BOOL CALLBACK DisplayPropProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch (Message)
{
case WM_INITDIALOG:
//**************************************************************************
// Do I want to allow no options checked?
// Need to rezoom depending upon selection.
// ...therefore need to recalc min max for each option.
// ...Send a paint message to redraw picture.
// Set default radio button.
if(bDisplayCoords)
{
hdlg = GetDlgItem(hwnd, IDC_DISPLAY_COORDINATES );
SendMessage(hdlg, BM_SETCHECK, 1,0);
}
else
{
hdlg = GetDlgItem(hwnd, IDC_LENGTHSANGLES );
SendMessage(hdlg, BM_SETCHECK, 1,0);
}
//if(SendMessage(GetDlgItem(hwnd, IDC_LENGTHSANGLES ), BM_GETCHECK, (WPARAM)0 ,(LPARAM)0) == BST_CHECKED)
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
if(SendMessage(GetDlgItem(hwnd, IDC_DISPLAY_COORDINATES ), BM_GETCHECK, (WPARAM)0 ,(LPARAM)1) == BST_CHECKED)
{
bDisplayCoords = true;
InvalidateRect(hwnd, NULL, true);
UpdateWindow (hwnd);
}
if(SendMessage(GetDlgItem(hwnd, IDC_LENGTHSANGLES ), BM_GETCHECK, (WPARAM)0 ,(LPARAM)0) == BST_CHECKED)
{
bDisplayCoords = false;
}
EndDialog(hwnd, IDOK);
break;
case IDCANCEL:
MessageBeep (0);
EndDialog(hwnd, IDCANCEL);
break;
}
default:
return FALSE;
}
return true;
}
What am I doing incorrectly?