Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Shortcut Bar
  New Posts New Posts RSS Feed - Shortcutbar without doc/view
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Shortcutbar without doc/view

 Post Reply Post Reply
Author
Message
BobWansink View Drop Down
Groupie
Groupie
Avatar

Joined: 24 January 2008
Status: Offline
Points: 59
Post Options Post Options   Thanks (0) Thanks(0)   Quote BobWansink Quote  Post ReplyReply Direct Link To This Post Topic: Shortcutbar without doc/view
    Posted: 16 April 2008 at 5:25am
Hi everyone,

I'm struggling with an interesting problem. Our application doesn't have a document/view architecture. Is it possible to add a Shortcutbar to the application without having to use the code:

    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
        IDR_MAINFRAME,
        RUNTIME_CLASS(CShortcutBarDoc),
        RUNTIME_CLASS(CMainFrame),       // main SDI frame window
        RUNTIME_CLASS(CShortcutBarView));
    AddDocTemplate(pDocTemplate);

Since i don't have a doc and view, i can't make a CSingleDocTemplate and without the template pointer my application won't work...

I'd like to hear your ideas about this. Is it necessary to make de doctemplate or can i do without? Can I create de doctemplate without a document and view?

Thanks in advance!

Bob
Back to Top
BobWansink View Drop Down
Groupie
Groupie
Avatar

Joined: 24 January 2008
Status: Offline
Points: 59
Post Options Post Options   Thanks (0) Thanks(0)   Quote BobWansink Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2008 at 7:47am
I've been working ahead for a while now, and I'm stuck at the following situation:

I have an application without Document/View Architecture. As such, I can't use the above mentioned code (CSingleDocTemplate).

I want to add the Shortcutbar, but adding it to CMainFrame as member requires CMainFrame to have a 'protected' default constructor. Using a public constructor causes a debug assertion, since the system is going to try to create the CXTPShortcutBar outside of my createShortcutBar method.


Without the public CMainFrame constructor, I won't be able to add the Shortcutbar; with it, you're forcing me to use the Document/View architecture, which isn't what I want.  

I hope my explanation isn't all too muddled by bad english, and I hope to recieve an answer soon.

Bob
Back to Top
BobWansink View Drop Down
Groupie
Groupie
Avatar

Joined: 24 January 2008
Status: Offline
Points: 59
Post Options Post Options   Thanks (0) Thanks(0)   Quote BobWansink Quote  Post ReplyReply Direct Link To This Post Posted: 21 April 2008 at 6:16am
I've been plowing ahead for a while now. I've managed to get most things working like i want them to, but one little problem remains:

My CMainFrame class has a CXTPShortcutBar member. Creating a CMainFrame object without doc/view support, the default constructor is called. In DEBUG mode, it shows me a debug assertion failure at line 53 of xtpshortcutbarpaintmanager.cpp, where it tries the following:

line 52:   
iconHandle.CreateIconFromResource(AfxFindResourceHandle(MAKEINTRESOURCE(XTP_IDI_SHORTCUT_EXPAND_ALPHA),
        RT_GROUP_ICON), MAKEINTRESOURCE(XTP_IDI_SHORTCUT_EXPAND_ALPHA), CSize(16, 16), TRUE);
line 53: (breaking the application)
ASSERT(!iconHandle.IsEmpty());

simply ignoring the problem, the debugger continues and the shortcutbar is created without any problems. The application runs smoothly and doesn't crash.

Running the application in "Release" mode doesn't generate the exception (since assert is debug only..) and runs the application smoothly. It seems that the call to iconHandle.CreateIconFromResource() fails, causing the debug assertion.

Does anyone know what I'm doing wrong here? Anyone from the CJ-Team know what's happening?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 21 April 2008 at 8:44am
Hi,
If you build application statically you need add toolkit resource to your exe.
 
in res\app.rc2 file add
#include "XtToolkitPro.rc"
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
BobWansink View Drop Down
Groupie
Groupie
Avatar

Joined: 24 January 2008
Status: Offline
Points: 59
Post Options Post Options   Thanks (0) Thanks(0)   Quote BobWansink Quote  Post ReplyReply Direct Link To This Post Posted: 22 April 2008 at 5:08am
Thanks Oleg! That solved it!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.157 seconds.