Skip to content

Commit 893715b

Browse files
authored
[MSPAINT] Fix focus and radiobuttons of some dialogs (reactos#5537)
- Return TRUE on WM_INITDIALOG handling to set focus. - Check if the radiobutton is checked on the radiobutton action (considering BN_SETFOCUS etc.). CORE-18011
1 parent ba53f72 commit 893715b

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

base/applications/mspaint/dialogs.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ LRESULT CMirrorRotateDialog::OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lPara
4242
{
4343
CheckDlgButton(IDD_MIRRORROTATERB1, BST_CHECKED);
4444
CheckDlgButton(IDD_MIRRORROTATERB4, BST_CHECKED);
45-
return 0;
45+
return TRUE;
4646
}
4747

4848
LRESULT CMirrorRotateDialog::OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -74,6 +74,9 @@ LRESULT CMirrorRotateDialog::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl,
7474

7575
LRESULT CMirrorRotateDialog::OnRadioButton3(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
7676
{
77+
if (IsDlgButtonChecked(IDD_MIRRORROTATERB3) != BST_CHECKED)
78+
return 0;
79+
7780
::EnableWindow(GetDlgItem(IDD_MIRRORROTATERB4), TRUE);
7881
::EnableWindow(GetDlgItem(IDD_MIRRORROTATERB5), TRUE);
7982
::EnableWindow(GetDlgItem(IDD_MIRRORROTATERB6), TRUE);
@@ -82,6 +85,12 @@ LRESULT CMirrorRotateDialog::OnRadioButton3(WORD wNotifyCode, WORD wID, HWND hWn
8285

8386
LRESULT CMirrorRotateDialog::OnRadioButton12(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
8487
{
88+
if (IsDlgButtonChecked(IDD_MIRRORROTATERB1) != BST_CHECKED &&
89+
IsDlgButtonChecked(IDD_MIRRORROTATERB2) != BST_CHECKED)
90+
{
91+
return 0;
92+
}
93+
8594
::EnableWindow(GetDlgItem(IDD_MIRRORROTATERB4), FALSE);
8695
::EnableWindow(GetDlgItem(IDD_MIRRORROTATERB5), FALSE);
8796
::EnableWindow(GetDlgItem(IDD_MIRRORROTATERB6), FALSE);
@@ -122,7 +131,7 @@ LRESULT CAttributesDialog::OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lParam,
122131
strRes.Format(IDS_PRINTRES, ROUND(PpcmFromDpi(g_xDpi)), ROUND(PpcmFromDpi(g_yDpi)));
123132

124133
SetDlgItemText(IDD_ATTRIBUTESTEXT8, strRes);
125-
return 0;
134+
return TRUE;
126135
}
127136

128137
LRESULT CAttributesDialog::OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -156,6 +165,9 @@ LRESULT CAttributesDialog::OnDefault(WORD wNotifyCode, WORD wID, HWND hWndCtl, B
156165

157166
LRESULT CAttributesDialog::OnRadioButton1(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
158167
{
168+
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1) != BST_CHECKED)
169+
return 0;
170+
159171
CString strNum;
160172
strNum.Format(_T("%.3lf"), newWidth / g_xDpi);
161173
SetDlgItemText(IDD_ATTRIBUTESEDIT1, strNum);
@@ -166,6 +178,9 @@ LRESULT CAttributesDialog::OnRadioButton1(WORD wNotifyCode, WORD wID, HWND hWndC
166178

167179
LRESULT CAttributesDialog::OnRadioButton2(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
168180
{
181+
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2) != BST_CHECKED)
182+
return 0;
183+
169184
CString strNum;
170185
strNum.Format(_T("%.3lf"), newWidth / PpcmFromDpi(g_xDpi));
171186
SetDlgItemText(IDD_ATTRIBUTESEDIT1, strNum);
@@ -176,6 +191,9 @@ LRESULT CAttributesDialog::OnRadioButton2(WORD wNotifyCode, WORD wID, HWND hWndC
176191

177192
LRESULT CAttributesDialog::OnRadioButton3(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
178193
{
194+
if (IsDlgButtonChecked(IDD_ATTRIBUTESRB3) != BST_CHECKED)
195+
return 0;
196+
179197
SetDlgItemInt(IDD_ATTRIBUTESEDIT1, newWidth, FALSE);
180198
SetDlgItemInt(IDD_ATTRIBUTESEDIT2, newHeight, FALSE);
181199
return 0;
@@ -239,7 +257,7 @@ LRESULT CStretchSkewDialog::OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lParam
239257
SetDlgItemInt(IDD_STRETCHSKEWEDITVSTRETCH, 100, FALSE);
240258
SetDlgItemInt(IDD_STRETCHSKEWEDITHSKEW, 0, FALSE);
241259
SetDlgItemInt(IDD_STRETCHSKEWEDITVSKEW, 0, FALSE);
242-
return 0;
260+
return TRUE;
243261
}
244262

245263
LRESULT CStretchSkewDialog::OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)

0 commit comments

Comments
 (0)