Solved

Get OnNotify on Dialog

Posted on 2011-09-29
6
1,185 Views
Last Modified: 2012-05-12
Hello,
I use a custom CProperySheet to catch the Tab SelChange Message. Eerything no problem, but how can I bypass it to the parent CDialog? I use attached code in the sublcass CPropertySheet.
Do I have to work with Reflect messages?

Ocrana
BOOL CResizablePropertySheet::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
	NMHDR* pNMHDR = (LPNMHDR) lParam;
	
	// The sheet resizes the page whenever it is activated
	// so we need to resize it to what we want
	if (pNMHDR->code == TCN_SELCHANGE)
		// user-defined message needs to be posted, not sent, because
		// page must be resized after TCN_SELCHANGE has been processed.
		PostMessage(WM_RESIZEPAGE);

	return CPropertySheet::OnNotify(wParam, lParam, pResult);
}

Open in new window

0
Comment
Question by:Ocrana
  • 4
  • 2
6 Comments
 
LVL 33

Expert Comment

by:sarabande
ID: 36889992
the current code sends a WM_RESIZE to the property sheet itself, such that you can handle the message in OnResizePage:

LONG CResizablePropertySheet::OnResizePage(UINT, LONG)
{
   CPropertyPage * pPage = GetActivePage();
   ASSERT (pPage);
   pPage->MoveWindow(&m_rectPage);
   return 0;
}

Open in new window


here the GetActivePage would return a pointer to the new child dialog.

Sara
0
 

Author Comment

by:Ocrana
ID: 36890009
BUt the : return CPropertySheet::OnNotify(wParam, lParam, pResult); do not have any effect to the Parent window? I assume it will be send to the parent, too.
0
 
LVL 33

Expert Comment

by:sarabande
ID: 36890080
what parent do you mean? the property sheet is the parent window of all its pages. you can get a page window by GetActivePage() or GetPage(index) in the property sheet class (your derived class). then you can cast that pointer to the appropriate dialog class and call functions of that dialog. no need to send any notifications.

Sara
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 33

Expert Comment

by:sarabande
ID: 36890088
the call CPropertySheet::OnNotify(wParam, lParam, pResult) will change the active page of its tab control member. so before and after that call you would get old and new page by GetActivePage.

Sara
0
 

Author Comment

by:Ocrana
ID: 36890171
@sarabande
The parent iis the CDialog where the CPropertySheet is added to, please read my question.

So the parent window (CDialog) will not be able to receive the OnNotify message, too? Nothing about bypassed or reflected?
0
 
LVL 33

Accepted Solution

by:
sarabande earned 500 total points
ID: 36890281
if you have a parent dialog of the property sheet you can get a pointer to it by

CMyParentDialog * pParDlg = (CMyParentDialog *)GetParent();
if (pParDlg != NULL)
{
   pParDlg->notifyPageChange();
}

Open in new window


the notifyPageChange would be a public member function you have to provide. of course you can add arguments like old_page_index, new_page_index and more to the function.

Sara
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
listing all functions in JavaScript 19 201
draw a Christmas tree by using a nested loop? 26 62
How to Correctly derive class from CWinThread in MFC 4 39
PL SQL Developer 7 35
This article will show, step by step, how to integrate R code into a R Sweave document
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question