![]() |
Calling GetActiveDocument from CMainFrame |
Post Reply
|
| Author | |
gpeffers
Newbie
Joined: 02 May 2007 Status: Offline Points: 2 |
Post Options
Thanks(0)
Quote Reply
Topic: Calling GetActiveDocument from CMainFramePosted: 09 May 2007 at 3:36pm |
|
I'm trying to call GetActiveDocument() from within a CMainFrame class derived from CXTPFrameWnd, but the call always returns NULL. Tracing into the GetActiveDocument() call, it appears to return NULL because the View is also NULL.
I'm working on an app using a ShortcutBar. Just to see if I could narrow down the problem, I've taken the Codejock ShortcutBar sample app and added a call to GetActiveDocument() in the CMainFrame::OnCustomize member and I still see NULL returned for the document. I chose this member function only because everything should have been completely initialized by the time is was available.
Can anyone give me a clue as to what I'm doing wrong? I'm working with XTP 11.1.0.
Thank you,
Glenn
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 10 May 2007 at 1:29am |
|
Hi,
if you use MDI its correct behavior.
call GetActiveFrame()->GetActiveDocument() instead.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
gpeffers
Newbie
Joined: 02 May 2007 Status: Offline Points: 2 |
Post Options
Thanks(0)
Quote Reply
Posted: 10 May 2007 at 9:07am |
|
oleg,
I'm sorry, but this does not fix it. The document is still returned as NULL even in the Codejock ShortcutBar sample.
Just to clarify, what I've done is added a line of code to the standard Codejock ShortcutBar sample as shown below:
void CMainFrame::OnCustomize()
{
GetActiveFrame()->GetActiveDocument();
// get a pointer to the command bars object.
CXTPCommandBars* pCommandBars = GetCommandBars();
if (pCommandBars == NULL)
return;
...........
I've added the code here only as a test to see if I can get the active document once the app is up and running. Inside GetActiveDocument(), the call to GetActiveView() returns NULL and therefore returns NULL for the document as well.
I'm not sure if it's ShortcutBar related, but this works fine in other applications.
Thanks,
Glenn |
|
![]() |
|
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 |