![]()  | 
 
CXTPTaskDialog ignoring parent | 
 
    Post Reply  
   | 
  
| Author | |
   
   adrien  
   
   Senior Member  
   Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Topic: CXTPTaskDialog ignoring parentPosted: 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. 
    | 
 |
![]()  | 
 |
   
   adrien  
   
   Senior Member  
   Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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. 
    | 
 |
![]()  | 
 |
   
   adrien  
   
   Senior Member  
   Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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. 
    | 
 |
![]()  | 
 |
   
   adrien  
   
   Senior Member  
   Joined: 30 April 2007 Location: New Zealand Status: Offline Points: 449  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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. 
    | 
 |
![]()  | 
 |
   
   Oleg  
   
   Senior Member  
   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 11 February 2008 at 8:36am | 
 
| 
   
    
   Thanks, we added m_pParentWnd = pParentWnd line.
    
   
   | 
 |
| 
   
     
     Oleg, Support Team 
   
  CODEJOCK SOFTWARE SOLUTIONS  | 
 |
![]()  | 
 |
    Post Reply  
   | 
  |
|       
  
  Tweet   	
    | 
 
| Forum Jump | Forum Permissions  ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum  |