Overriding OK button in CPropertySheet
Eric J.A. Bryant -- ejab@village.ios.com
Monday, January 27, 1997
Environment: VC++4.0;WinNT4.0
Hello all,
I simply wish to override the default implementation of the OK button in
the CPropertySheet. I do not mean simply overriding the OnOK() function,
which is too late as it has already OnApply()ed to every "dirty" page.
I'm guessing I need to override ON_COMMAND but I am not sure which
parameters (wParam, lParam) to check for IDOK.
Thanks in advance,
Eric J. Bryant
InterWorld Technology Ventures, Inc.
Rondal C. Ellifritt -- rondal@mvision.com
Tuesday, January 28, 1997
[Mini-digest: 2 responses]
Eric Bryant wrote:
>
> Environment: VC++4.0;WinNT4.0
>
> I simply wish to override the default implementation of the OK button in
> the CPropertySheet. I do not mean simply overriding the OnOK() function,
> which is too late as it has already OnApply()ed to every "dirty" page.
> I'm guessing I need to override ON_COMMAND but I am not sure which
> parameters (wParam, lParam) to check for IDOK.
Why not override OnApply() instead? Or in addition?
Rondal
--
____________________________________________________________________________
Rondal C. Ellifritt rondal@mvision.com
-----From: ktm@ormec.com
On mfc-l, Eric J. Bryant, (ejab@village.ios.com) wrote:
> Environment: VC++4.0;WinNT4.0
>
> I simply wish to override the default implementation of the OK button in
> the CPropertySheet. I do not mean simply overriding the OnOK() function,
> which is too late as it has already OnApply()ed to every "dirty" page.
> I'm guessing I need to override ON_COMMAND but I am not sure which
> parameters (wParam, lParam) to check for IDOK.
Command messages don't have parameters; see the online help for "WM_COMMAND
message handler", which shows the function prototype. So you ought to be
able to manually add to the message map:
BEGIN_MESSAGE_MAP(CMyPropSheet, CPropertySheet)
//{{AFX_MSG_MAP(CMyPropSheet)
//}}AFX_MSG_MAP
ON_COMMAND(IDOK, OnOK)
END_MESSAGE_MAP()
void CMyPropSheet::OnOK()
{
TRACE("CMyPropSheet::OnOK\n");
// Do whatever you want.
}
I believe this will completely hide the default behavior.
Katy
--
Katy Mulvey ktm@ormec.com
Software Development Engineer
ORMEC Systems http://www.ormec.com
Tipparaju Surendra -- tips@mri.co.jp
Thursday, January 30, 1997
Hi
If idea is to just handle the IDOK message of Property sheet
I do it this way,
BOOL CMySheet::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
// TODO: $B$3$N0LCV$K8GM-$N=hM}$rDI2C$9$k$+!"$^$?$O4pK\%/%i%9$r8F$S=P$7$F$/$@$5$$(J
BOOL ret ;
if(nID == IDOK)
{
.... Your code goes here .....
ret = < Set based on Ur conditions >
}
else
{
ret = CPropertySheet::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
return ret ;
}
Hope this helps
Tips
----------
From: Rondal C. Ellifritt
Sent: Wednesday, January 29, 1997 8:01 AM
To: Eric Bryant; mfc-l@netcom.com
Subject: Re: Overriding OK button in CPropertySheet
[Mini-digest: 2 responses]
Eric Bryant wrote:
>
> Environment: VC++4.0;WinNT4.0
>
> I simply wish to override the default implementation of the OK button in
> the CPropertySheet. I do not mean simply overriding the OnOK() function,
> which is too late as it has already OnApply()ed to every "dirty" page.
> I'm guessing I need to override ON_COMMAND but I am not sure which
> parameters (wParam, lParam) to check for IDOK.
Why not override OnApply() instead? Or in addition?
Rondal
--
____________________________________________________________________________
Rondal C. Ellifritt rondal@mvision.com
-----From: ktm@ormec.com
On mfc-l, Eric J. Bryant, (ejab@village.ios.com) wrote:
> Environment: VC++4.0;WinNT4.0
>
> I simply wish to override the default implementation of the OK button in
> the CPropertySheet. I do not mean simply overriding the OnOK() function,
> which is too late as it has already OnApply()ed to every "dirty" page.
> I'm guessing I need to override ON_COMMAND but I am not sure which
> parameters (wParam, lParam) to check for IDOK.
Command messages don't have parameters; see the online help for "WM_COMMAND
message handler", which shows the function prototype. So you ought to be
able to manually add to the message map:
BEGIN_MESSAGE_MAP(CMyPropSheet, CPropertySheet)
//{{AFX_MSG_MAP(CMyPropSheet)
//}}AFX_MSG_MAP
ON_COMMAND(IDOK, OnOK)
END_MESSAGE_MAP()
void CMyPropSheet::OnOK()
{
TRACE("CMyPropSheet::OnOK\n");
// Do whatever you want.
}
I believe this will completely hide the default behavior.
Katy
--
Katy Mulvey ktm@ormec.com
Software Development Engineer
ORMEC Systems http://www.ormec.com
| Вернуться в корень Архива
|