Skip to content

Commit 132847d

Browse files
committed
Fixed the same bug involving disabled controls in the Global Preferences dialog.
1 parent 03d9dd1 commit 132847d

File tree

4 files changed

+111
-0
lines changed

4 files changed

+111
-0
lines changed

dialogs/global_prefs/GlobalPrefs.cpp

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,3 +1855,79 @@ LRESULT CGlobalPrefsP13::OnKickIdle(WPARAM, LPARAM)
18551855
UpdateDialogControls (AfxGetApp()->m_pMainWnd, false);
18561856
return 0;
18571857
} // end of CGlobalPrefsP13::OnKickIdle
1858+
1859+
/////////////////////////////////////////////////////////////////////////////
1860+
// Sometimes it is useful to know when we become the active page
1861+
// Copied the structure from World Properties.
1862+
1863+
BOOL CGlobalPrefsP1::OnSetActive()
1864+
{
1865+
((CGlobalPrefsSheet *) GetParent ())->PageHasChanged (this);
1866+
return CPropertyPage::OnSetActive();
1867+
}
1868+
1869+
BOOL CGlobalPrefsP2::OnSetActive()
1870+
{
1871+
((CGlobalPrefsSheet *) GetParent ())->PageHasChanged (this);
1872+
return CPropertyPage::OnSetActive();
1873+
}
1874+
1875+
BOOL CGlobalPrefsP3::OnSetActive()
1876+
{
1877+
((CGlobalPrefsSheet *) GetParent ())->PageHasChanged (this);
1878+
return CPropertyPage::OnSetActive();
1879+
}
1880+
1881+
BOOL CGlobalPrefsP4::OnSetActive()
1882+
{
1883+
((CGlobalPrefsSheet *) GetParent ())->PageHasChanged (this);
1884+
return CPropertyPage::OnSetActive();
1885+
}
1886+
1887+
BOOL CGlobalPrefsP5::OnSetActive()
1888+
{
1889+
((CGlobalPrefsSheet *) GetParent ())->PageHasChanged (this);
1890+
return CPropertyPage::OnSetActive();
1891+
}
1892+
1893+
BOOL CGlobalPrefsP6::OnSetActive()
1894+
{
1895+
((CGlobalPrefsSheet *) GetParent ())->PageHasChanged (this);
1896+
return CPropertyPage::OnSetActive();
1897+
}
1898+
1899+
BOOL CGlobalPrefsP7::OnSetActive()
1900+
{
1901+
((CGlobalPrefsSheet *) GetParent ())->PageHasChanged (this);
1902+
return CPropertyPage::OnSetActive();
1903+
}
1904+
1905+
BOOL CGlobalPrefsP9::OnSetActive()
1906+
{
1907+
((CGlobalPrefsSheet *) GetParent ())->PageHasChanged (this);
1908+
return CPropertyPage::OnSetActive();
1909+
}
1910+
1911+
BOOL CGlobalPrefsP10::OnSetActive()
1912+
{
1913+
((CGlobalPrefsSheet *) GetParent ())->PageHasChanged (this);
1914+
return CPropertyPage::OnSetActive();
1915+
}
1916+
1917+
BOOL CGlobalPrefsP11::OnSetActive()
1918+
{
1919+
((CGlobalPrefsSheet *) GetParent ())->PageHasChanged (this);
1920+
return CPropertyPage::OnSetActive();
1921+
}
1922+
1923+
BOOL CGlobalPrefsP12::OnSetActive()
1924+
{
1925+
((CGlobalPrefsSheet *) GetParent ())->PageHasChanged (this);
1926+
return CPropertyPage::OnSetActive();
1927+
}
1928+
1929+
BOOL CGlobalPrefsP13::OnSetActive()
1930+
{
1931+
((CGlobalPrefsSheet *) GetParent ())->PageHasChanged (this);
1932+
return CPropertyPage::OnSetActive();
1933+
}

dialogs/global_prefs/GlobalPrefs.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class CGlobalPrefsP1 : public CPropertyPage
3636
//{{AFX_VIRTUAL(CGlobalPrefsP1)
3737
public:
3838
virtual void OnOK();
39+
virtual BOOL OnSetActive();
3940
protected:
4041
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
4142
//}}AFX_VIRTUAL
@@ -106,6 +107,8 @@ class CGlobalPrefsP2 : public CPropertyPage
106107
// Overrides
107108
// ClassWizard generate virtual function overrides
108109
//{{AFX_VIRTUAL(CGlobalPrefsP2)
110+
public:
111+
virtual BOOL OnSetActive();
109112
protected:
110113
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
111114
//}}AFX_VIRTUAL
@@ -145,6 +148,8 @@ class CGlobalPrefsP3 : public CPropertyPage
145148
// Overrides
146149
// ClassWizard generate virtual function overrides
147150
//{{AFX_VIRTUAL(CGlobalPrefsP3)
151+
public:
152+
virtual BOOL OnSetActive();
148153
protected:
149154
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
150155
//}}AFX_VIRTUAL
@@ -187,6 +192,8 @@ class CGlobalPrefsP4 : public CPropertyPage
187192
// Overrides
188193
// ClassWizard generate virtual function overrides
189194
//{{AFX_VIRTUAL(CGlobalPrefsP4)
195+
public:
196+
virtual BOOL OnSetActive();
190197
protected:
191198
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
192199
//}}AFX_VIRTUAL
@@ -228,6 +235,8 @@ class CGlobalPrefsP5 : public CPropertyPage
228235
// Overrides
229236
// ClassWizard generate virtual function overrides
230237
//{{AFX_VIRTUAL(CGlobalPrefsP5)
238+
public:
239+
virtual BOOL OnSetActive();
231240
protected:
232241
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
233242
//}}AFX_VIRTUAL
@@ -265,6 +274,8 @@ class CGlobalPrefsP6 : public CPropertyPage
265274
// Overrides
266275
// ClassWizard generate virtual function overrides
267276
//{{AFX_VIRTUAL(CGlobalPrefsP6)
277+
public:
278+
virtual BOOL OnSetActive();
268279
protected:
269280
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
270281
//}}AFX_VIRTUAL
@@ -304,6 +315,8 @@ class CGlobalPrefsP7 : public CPropertyPage
304315
// Overrides
305316
// ClassWizard generate virtual function overrides
306317
//{{AFX_VIRTUAL(CGlobalPrefsP7)
318+
public:
319+
virtual BOOL OnSetActive();
307320
protected:
308321
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
309322
//}}AFX_VIRTUAL
@@ -364,6 +377,8 @@ class CGlobalPrefsP9 : public CPropertyPage
364377
// Overrides
365378
// ClassWizard generate virtual function overrides
366379
//{{AFX_VIRTUAL(CGlobalPrefsP9)
380+
public:
381+
virtual BOOL OnSetActive();
367382
protected:
368383
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
369384
//}}AFX_VIRTUAL
@@ -428,6 +443,7 @@ class CGlobalPrefsP10 : public CPropertyPage
428443
//{{AFX_VIRTUAL(CGlobalPrefsP10)
429444
public:
430445
virtual void OnOK();
446+
virtual BOOL OnSetActive();
431447
protected:
432448
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
433449
//}}AFX_VIRTUAL
@@ -472,6 +488,8 @@ class CGlobalPrefsP11 : public CPropertyPage
472488
// Overrides
473489
// ClassWizard generate virtual function overrides
474490
//{{AFX_VIRTUAL(CGlobalPrefsP11)
491+
public:
492+
virtual BOOL OnSetActive();
475493
protected:
476494
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
477495
//}}AFX_VIRTUAL
@@ -512,6 +530,7 @@ class CGlobalPrefsP12 : public CPropertyPage
512530
//{{AFX_VIRTUAL(CGlobalPrefsP12)
513531
public:
514532
virtual void OnOK();
533+
virtual BOOL OnSetActive();
515534
protected:
516535
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
517536
//}}AFX_VIRTUAL
@@ -558,6 +577,8 @@ class CGlobalPrefsP13 : public CPropertyPage
558577
// Overrides
559578
// ClassWizard generate virtual function overrides
560579
//{{AFX_VIRTUAL(CGlobalPrefsP13)
580+
public:
581+
virtual BOOL OnSetActive();
561582
protected:
562583
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
563584
//}}AFX_VIRTUAL

dialogs/global_prefs/GlobalPrefsSheet.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,16 @@ BOOL CGlobalPrefsSheet::OnInitDialog()
7373
return bResult;
7474
}
7575

76+
void CGlobalPrefsSheet::PageHasChanged (CPropertyPage* pNewPage)
77+
{
78+
/* Theming has these nice fades inbetween controls being disabled and enabled.
79+
* That is all nice and well, but switching a page for the _first_ time since
80+
* the dialog had been opened causes the dialog controls to be updated in plain
81+
* sight - a rather visible and eye-catching affair once you are aware of it.
82+
* Updating the dialog controls manually before switching to the active page
83+
* causes these updates to be done while the user cannot see it. -JW
84+
*/
85+
pNewPage->UpdateDialogControls(this, false);
86+
}
87+
88+

dialogs/global_prefs/GlobalPrefsSheet.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class CGlobalPrefsSheet : public CPropertySheet
5252
// Implementation
5353
public:
5454
virtual ~CGlobalPrefsSheet();
55+
void PageHasChanged (CPropertyPage* pPage);
5556

5657
// Generated message map functions
5758
protected:

0 commit comments

Comments
 (0)