Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get OnNotify on Dialog

Posted on 2011-09-29
6
Medium Priority
?
1,260 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 35

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 35

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 35

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 35

Accepted Solution

by:
sarabande earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
In this post we will learn different types of Android Layout and some basics of an Android App.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Simple Linear Regression

927 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