Modeless dialog box

  • Thread starter Thread starter Manjree Garg
  • Start date Start date
M

Manjree Garg

Hi

I am creating a modeless dialogbox. The problem is in keeping track of it.
How can I keep track of it in CDocument class (CBioSpecDoc) so that I don't
create multiple instance of it when it is still active. When I cancel it; it
destroys it using the OnCancel() function of the dialog box that I override
as follows:

void RbfPropDlg::OnCancel()
{
//m_activeDlg = false;
DestroyWindow();
}

void RbfPropDlg::PostNcDestroy()
{
delete this;
}


If I make RbfPropDlg a member variable of CBioSpecDoc class how can I set it
NULL when OnCancel()????

Cheers.

Manjree
 
Hi Manjree,

I think a simple solution is passing the pointer to the parent CBioSpecDoc
to the RbfPropDlg class and storing it as a private member variable.

Then, in RbfPropDlg::OnCancel() method, you may set the member variable in
the CBioSpecDoc class using the stored member variable in RbfPropDlg class.

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Jefferey

Thanks for your reply.

The problem is how to make CBioSpecDoc a parent of RbfPropDlg??? The
constructor I have contains CWnd* as a parent as follows:

RbfPropDlg::RbfPropDlg(CWnd* pParent /*=NULL*/)
: CDialog(RbfPropDlg::IDD, pParent)
, m_actvFunc(_T(""))
, m_itr(0)
{
ASSERT(pParent != NULL);

m_pParent = pParent;
m_nID = RbfPropDlg::IDD;
m_activeDlg = true;

}

and if I change it to CBioSpecDoc* it does not work.

Cheers.

Manjree
 
Hi Manjree,

I may not understand you completely. Why do you need to set CBioSpecDoc as
the parent of RbfPropDlg? I think once you have a stored CBioSpecDoc
pointer in the RbfPropDlg, you may manipulate CBioSpecDoc fields/members
from RbfPropDlg::OnCancel() method.

If I have misunderstood your concern, please feel free to feedback, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top