In a MFC custom checkbox i want to ask the user if he is sure, to change the value. So i tried this:
void CADSCheckBox::OnLButtonUp(UINT nFlags, CPoint point)
{
bool s1, s2;
if (!mb_ask_user)
{
// standard behaviour
s1 = (GetCheck() == BST_CHECKED);
CButton::OnLButtonUp(nFlags, point);
s2 = (GetCheck() == BST_CHECKED);
return;
}
int answer = AfxMessageBox("Are you sure?", MB_YESNO);
if (answer == IDYES)
{
s1= (GetCheck() == BST_CHECKED);
CButton::OnLButtonUp(nFlags, point);
s2 = (GetCheck() == BST_CHECKED);
}
int t = 1;
}
If i dont rise the MessageBox, it works. But if the MessageBox pops up, it doesnt work. s1 and s2 are just checks to debug the issue. In the Standard behaviour it shows s1 = false
and s2=true
.
What to change, that i can ask the user and get my intended behaviour?
Win7 + MSVC 2013
Aucun commentaire:
Enregistrer un commentaire