15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


CPropertyPage OnApply wierdness

Rickard Lind -- rickard.lind@st.se
Tuesday, September 24, 1996

Environment: Win NT 3.51, VC++ 4.1

I have a CPropertySheet derivative and three
CPropertyPage derivatives(CPP). Each CPP overrides
the OnOK() and OnApply() virtual functions. But
whenever I click the OK button, the OnApply() function
gets called. Has anyone else seen this?

Regards,
/r
____________________________________________________________
 Rickard Lind                     mailto:rickard.lind@st.se
 S&T Datakonsulter                         http://www.st.se
 Valhallav. 191                         voice:+46 8 7832714
 Box 27183                                fax:+46 8 6678230
 104 51 Stockholm                       cell:+46 708 432484




Benny -- blee@filenet.com
Wednesday, September 25, 1996

[Mini-digest: 4 responses]


I believe that is the way it is suppose to work.  Think of clicking "OK" as 
applying the changes and then saving the changes.

Benny
 ----------
From: owner-mfc-l
To: mfc-l
Subject: CPropertyPage OnApply wierdness
Date: Tuesday, September 24, 1996 2:25PM

Environment: Win NT 3.51, VC++ 4.1

I have a CPropertySheet derivative and three
CPropertyPage derivatives(CPP). Each CPP overrides
the OnOK() and OnApply() virtual functions. But
whenever I click the OK button, the OnApply() function
gets called. Has anyone else seen this?

Regards,
/r
____________________________________________________________
 Rickard Lind                     mailto:rickard.lind@st.se
 S&T Datakonsulter                         http://www.st.se
 Valhallav. 191                         voice:+46 8 7832714
 Box 27183                                fax:+46 8 6678230
 104 51 Stockholm                       cell:+46 708 432484

-----From: "Peter Friis" 

As Microsoft would put it:  "This behaviour is by design".

See VC++ 4.1's InfoViewer topic on CPropertyPage::OnApply(), which says

"This member function is called by the framework when the user chooses the
OK or the Apply Now button."

________________________________

Peter Friis
Software Engineer
Wallchart International Ltd
  Tel: +44 (1403) 275321
  Fax: +44 (1403) 275322
 http://www.wallchart.com
Email: peterf@wallchart.com
________________________________


-----From: Mario Contestabile

OnApply() is called by the framework when OK or apply now is selected.
Each page gets a chance to handle this, in the order in which the pages were
added to the sheet. If page 1 needs to know beforehand a status from page 3,
it can use QuerySiblings().

mcontest@universal.com

-----From: Jim Barry 

I found the documentation a little confusing - this may be because MFC   
had a CPropertySheet/CPropertyPage implementation before the Windows 95   
Propery Sheets came along.

The OnApply() handler is called whether it was the OK or Apply button   
that was clicked. This is reasonable because the only difference between   
the two operations is that the Property Sheet is also dismissed with the   
OK button. The Win32 Property Sheet control closes itself when the OK   
button is clicked - MFC does not explicitly cause this to happen.

The default implementation of OnApply() simply calls OnOK(). I assume   
this is either for compatibility with previous CPropertyPage   
implementations, or to make Property Pages seem more like regular   
dialogs, or both. Note that you have the opportunity in OnApply() to   
prevent changes taking place, but not in OnOK().

Jim Barry
Interactive Learning Productions
http://www.ilp.com  




| Вернуться в корень Архива |