Pane's OnInitDialog not called |
Post Reply |
Author | |
MichaelN
Senior Member Joined: 19 September 2006 Status: Offline Points: 112 |
Post Options
Thanks(0)
Posted: 08 June 2011 at 1:25pm |
I'll start by saying I've been using panes for some time for a lot of other things and they work fine. But I can't make this one work and I can't figure out the initialization sequence for it.
The pane uses a dialog that has a CEdit control that the app sends text strings to. The app starts with this pane docked to the side of the mainframe. Strings may be sent with or without the pane open, and the app sends some strings to it before the pane is opened the first time. Then, when I open the pane the first time, the app crashes. I can see that the dialog's OnInitDialog() was not called and the DDX was never called to attach a window to the edit control.
What I did to initialize: At the end of the mainframe's OnCreate(), the pane's dialog object was created and pane->Create(IDD,this) was called. The first message fired inside CMainFrame::OnDockingPaneNotify() is xtpPaneActionExpanding. Inside that case, pane->IsValid() returns FALSE. Therefore, I call pane->Attach(m_pPaneTextEditor) and it crashes. As I said, the dialog's OnInitDialog() was never called and the window handles are 0.
Where/how can I make this work in the pane opening sequence?
Thanks,
Michael
|
|
MichaelN
Senior Member Joined: 19 September 2006 Status: Offline Points: 112 |
Post Options
Thanks(0)
|
There's Progress, but there still is a glitch. I was able to prevent the crash by inserting the following code into CMainFrame::OnDockingPaneNotify()
After this change, I can open the pane without a crash. Remember that the app opens with this pane closed on the right main frame border. Text is written into its CEdit control before the pane is ever opened. After I open it the first time, it does not auto-hide. When I move the mouse off the pane, it does not snap shut. I fact, there's no way I can make it hide unless I pin and then unpin it.
On the other hand, if I open a document before opening the pane the first time, then the pane auto-hides as expected. But if I close the document before opening the pane the first time, the pane does not auto-hide. In other words, a document must be open when I open the pane the first time in order to have it auto-hide when it closes the first time.
After the pane closes once, it auto-hides correctly in the future.
Any thoughts?
Michael |
|
MichaelN
Senior Member Joined: 19 September 2006 Status: Offline Points: 112 |
Post Options
Thanks(0)
|
I forgot to mention a couple of things:
Identical code works as expected when the docking pane is attached to an MDI child frame instead of the MainFrame window.
Using ToolkitPro 13.4.2 DLL with x64 debug.
Michael
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
If you need this dialog before user open pane you can create it directly in CMainFrame::OnCreate and only attach here.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
MichaelN
Senior Member Joined: 19 September 2006 Status: Offline Points: 112 |
Post Options
Thanks(0)
|
Hi Oleg,
That is exactly what I already do, create panes at the end of the main frame's OnCreate(). The pane crashes because the pane dialog's window handle is 0 when OnDockingPaneNotify is called. I found that the dialog template fails in CheckDialogTemplate(lpszTemplateName, FALSE) inside CDialog::Create(LPCTSTR lpszTemplateName, CWnd* pParentWnd).
However, using identical pane code and creation code, everything works as expected when created on a CMDIChildWnd. I wonder if the mainframe is interfering with pane creation? My main frame is derived from two of your classes, like this:
class CMainFrame : public CXTPMDIFrameWnd, CXTPOffice2007FrameHookAre you sure they don't interfere with pane creation?
Michael |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Try create it before you create DockingPanes.
|
|
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 |