Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » CExtTabPageContainerWnd Buttons access from the CExtResizableDialog children Collapse All
Subject Author Date
Sandrine Chalier Mar 30, 2007 - 2:11 AM

I’d like to disable/enable the button "apply" of my CExtTabPageContainerWnd. I need to do it from "CExtResizableDialog" children.

I use GetParent() to get the adress of CExtTabPageContainerWnd.

When i call this->GetDlgItem( IDAPPLYCONFIGSY ) in my CExtTabPageContainerWnd code, i have a Null pointer.

How to solve it?


Dev 3DFeel

Sandrine Chalier Apr 2, 2007 - 4:16 AM

It works!!!
This creation method isn’t described by ProfUIs (the parent must be a CExtTabPageContainerWnd type) but i’ve not found any problem...



Sandrine Chalier Apr 2, 2007 - 3:12 AM

I’ve a CExtResizableDialog with a CExtTabPageContainerWnd member.
I insert 3 CExtResizableDialog in the OnInitDialog method.
Of course my button is on the parent (CExtResizableDialog).
In OnInitDialog, after insert the CExtResizableDialog in my CExtTabPageContainerWnd , i can manipulate my button.
If i try to do this from one of the 3 children, i can’t. Of course, i use the good parent window to call GetDlgItem...

I dont’ understand why the Parent context doesn’t exist when i use the children of the CExtTabPageContainerWnd...

Suhai Gyorgy Apr 2, 2007 - 3:53 AM

Before inserting the 3 CExtResizableDialog objects in the CExtTabPageContainerWnd, you need to call create on them, right? One of the parameters of this Create method defines which window will be the parent of that CExtResizableDialog objects. So if you set that parameter to be your CExtTabPageContainerWnd member, GetParent will return exactly what you need. If right now this parameter is set to this, GetParent should be returning your main dialog.

Sandrine Chalier Apr 2, 2007 - 12:06 AM

I use a CExtTabPageContainerWnd and not a PropertySheet. My button ID is IDAPPLYCONFIGSYS. My code is good.

Suhai Gyorgy Apr 2, 2007 - 1:50 AM

Please, let me try to understand the whole situation. What window is the CExtTabPageContainerWnd object located on? I mean do you have a view or dialog, and on that view or dialog you created a CExtTabPageContainerWnd object, right? And after that you called CExtTabPageContainerWnd::PageInsert a couple of times to insert some CExtResizableDialog children into the CExtTabPageContainerWnd, right? And you have an Apply button with id IDAPPLYCONFIGSYS. But which object is the parent of this button? I’d guess it is the view or dialog on which the CExtTabPageContainerWnd object is created. I can not imagine how the button could be the child of the CExtTabPageContainerWnd object. But if the button is the child of the main view or dialog, then you could use this code from one of the CExtResizableDialog children:

CWnd *COneChildResizableDialog::GetApplyButton() {
	CWnd *pTabPageContainerWnd = GetParent();
	CWnd *pMainWnd = pTabPageContainerWnd->GetParent();
	return pMainWnd->GetDlgItem( IDAPPLYCONFIGSYS );
If I’m still misunderstanding the situation, please provide some code that shows the creation of all the objects in question.

Suhai Gyorgy Mar 30, 2007 - 11:59 AM

GetParent()->GetDlgItem(ID_APPLY_NOW)->EnableWindow(FALSE); worked for me in one of the "CExtResizableDialog" children of ResizablePropertySheet sample’s main window. So probably the solution is you need to use ID_APPLY_NOW instead of IDAPPLYCONFIGSYS.