Solved

Get OnNotify on Dialog

Posted on 2011-09-29
6
1,204 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 34

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 34

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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 34

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 34

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

685 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