Print Page | Close Window

CXTPTaskDialog ignoring parent

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=9544
Printed Date: 28 March 2024 at 2:01pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPTaskDialog ignoring parent
Posted By: adrien
Subject: CXTPTaskDialog ignoring parent
Date Posted: 09 February 2008 at 4:05pm
Hi
 
I've got an app that uses a number of frame windows, each with views in them.  One for the main part of the app, and others that are spawned to edit specific content.
 
Whenever a user closes an edit frame, without saving changes, I post a CXTPTaskDialog-derived dialog to warn them about the changes.  I set the parent to be the sub-frame, however it always brings that main frame of the app to the front before displaying the dialog, so the frame the user was working in is immediately covered.
 
Using spy++ you can see the parent window for the dialog is the desktop, not the window I specified.  The dialog centers itself on the parent, but is not a child of the parent.



Replies:
Posted By: adrien
Date Posted: 09 February 2008 at 4:11pm
more on this.  this is on XP, so no built-in task dialog.
 
Inside CXTPTaskDialogFrame::DoModal(), it calls
 
InitModalIndirect(m_lpDlgTemplate);
 
this is a CDialog call, it should be passing the parent window pointer in here as well.


Posted By: adrien
Date Posted: 09 February 2008 at 4:15pm
looks like there will need to be a m_pParentWnd member added to CXTPTaskDialogFrame to store the pointer from the constructor to be used in DoModal.
 
Create allows you to pass in a parent, but I need this dialog to be modal.


Posted By: adrien
Date Posted: 09 February 2008 at 4:20pm
ignore that last one about adding the member.  It derives from CDIalog already.
 
I worked around it by setting
 
m_pParentWnd = pParentWnd
 
in the constructor of my derived class.  However, the constructor of the CXTPTaskDialogFrame (and parents) should be modified to allow passing the parent pointer up the constructor chain.


Posted By: Oleg
Date Posted: 11 February 2008 at 8:36am
Thanks, we added m_pParentWnd = pParentWnd line.

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net