Print Page | Close Window

Why OnInitDialog not called?

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=2987
Printed Date: 16 June 2024 at 10:09pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Why OnInitDialog not called?
Posted By: XTMFC
Subject: Why OnInitDialog not called?
Date Posted: 02 October 2005 at 11:20pm

I have a CXTPDockingPane in my ChildFrame.  The docking pane is attached to a CXTResizeDialog.  I wanted to do a few initializations in the OnInitDialog and controls resizing, but the function CXTResizeDialog::OnInitDialog was not called at all.  What did I do wrong?

I am using v9.601 pro.  Thanks in advance for any helps!

///////////////////////// Code ///////////////////////////

m_pwndContractSelector = m_paneManager.CreatePane ( IDR_PANE_CONTRACT_SELECTER,
                  CRect(0, 0,120, 120),
                  xtpPaneDockTop,
                  m_paneManager.GetC lientPane() );

    m_dlgContractSelector = new CXTResizeDialog();
    m_dlgContractSelector->Create(IDD _CONTRACT_SELECTOR,this);

    m_pwndContractSelector->Attach( m_dlgContractSelector );

    m_pwndContractSelector->SetOption s(xtpPaneNoCloseable);

 //   m_pwndContractSelector->GetChil d()->SendMessage(WM_INITDIALOG);




Replies:
Posted By: Warren
Date Posted: 04 October 2005 at 7:15am
Based on the function not getting called, my guess would be:

1) Make sure ALL of your "CDialog" entries in your dialog are replaced by
"CXTResizeDialog" (i.e. make sure the derivation is 100% correct)
...and don't forget the message map macros too!!! For example:
BEGIN_MESSAGE_MAP(DerivedDialogClass, BaseDialogClass)

Incorrect message maps are typically where the problem is when function calls go missing for me.

2) Make sure the window you get back from:
m_pwndContractSelector->GetChild()
is REALLY your dialog. Maybe it's something else, or a bad pointer ?!?

3) could be a creation-order issue (maybe the dialog already got the WM_INITDIALOG message), but this is just a wild guess.

Best of luck - tracking down bugs like this are never very fun.

Warren


Posted By: XTMFC
Date Posted: 04 October 2005 at 7:54pm

Hi Warren:

Thanks for your help.

I tried every poosible way of putting a dialog (CDialog or CXRResizeDialog) into a docking pane and got stuck at the very same point - OnInitDialog() call.  Not sure why this happens and I don't want to get into creating the controls using code in stead of using resource editor.

In the mean time, I just went back to a regular popup dialog to but I will always be interested in knowing if some one has the same issue and figured out the answer.

Thanks.



Posted By: Warren
Date Posted: 04 October 2005 at 9:06pm
I was thinking of doing something similar (although I'm not in a big hurry - it could be a month or two). I'll try to let you know if I figure something out...

Warren


Posted By: Warren
Date Posted: 16 December 2005 at 11:29am
XTMFC,

I got this working (i.e. a pane with re-sizeable controls in it, layout being done in the resource editor).

I'm using Xtreme Toolkit Pro 9.80 (if the version matters). Basically what I did was copy/paste from the "grep" example. It did almost exactly what we were both looking for.

Note: the "one time" initialization code is done in OnInitialUpdate and not
OnInitDialog. And also note, that this function gets called twice (so you'll need a m_bInitialized flag, like in the example) Maybe that was your issue ?!?

Warren



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