M
maddog
Sorry, bit of a noob question.
But if I bind a var to a radio control, then set that var just before
calling DoModal the control does not reflect the vars value. So I put a
UpdateData(0) in the OnInitDialog func, no joy. So I added.........
HWND hWndCtrl;
GetDlgItem(IDC_RADIO1, &hWndCtrl);
::SendMessage(hWndCtrl, BM_SETCHECK, (WPARAM)test_var, 0L);
and this works!
As far as I can see, that is what UpdateData(0) is doing, via DoDataExchange
and
DDX_Check(pDX,IDC_RADIO1,test_var)
Odd and i'm confused.
I've come up against this many times and in the past ended up adding MFX
contol object to do it, but i've decieded to once and for all find a way to
do it with out adding loads of CButton radio_button.... vars just to init
the control. If UpdateData(0) worked as I had expected I would have been a
happy chappy.
But if I bind a var to a radio control, then set that var just before
calling DoModal the control does not reflect the vars value. So I put a
UpdateData(0) in the OnInitDialog func, no joy. So I added.........
HWND hWndCtrl;
GetDlgItem(IDC_RADIO1, &hWndCtrl);
::SendMessage(hWndCtrl, BM_SETCHECK, (WPARAM)test_var, 0L);
and this works!
As far as I can see, that is what UpdateData(0) is doing, via DoDataExchange
and
DDX_Check(pDX,IDC_RADIO1,test_var)
Odd and i'm confused.
I've come up against this many times and in the past ended up adding MFX
contol object to do it, but i've decieded to once and for all find a way to
do it with out adding loads of CButton radio_button.... vars just to init
the control. If UpdateData(0) worked as I had expected I would have been a
happy chappy.