?
Solved

How to load an existing document template during run-time?

Posted on 2002-04-13
10
Medium Priority
?
212 Views
Last Modified: 2013-11-20
I have many document templates in a SDI application and I would load different document templates when user click on a particular menu item. For eg., when user click on 'Login' on the menu, how do I enable the program to load a particular document template to replace the recent one? Is this done by using the Runtime_Class? but how?
-sweetgirl-
0
Comment
Question by:sweetgirl
  • 5
  • 3
8 Comments
 
LVL 16

Expert Comment

by:AlexNek
ID: 6942291
2 sweetgirl
I don't think that you found a good solution for SDI because CSingleDocTemplate set CWinThread::m_pMainWnd for current opened frame. So you will be need to replace m_pMainWnd with a new one - and this is very bad idea IMHO.

Why you not try an other design? And why you need for Login dialog a Template is it not easy to make with the Dialog?
0
 

Author Comment

by:sweetgirl
ID: 6946848
The reason I chose SDI is because I only want one(single) document to be loaded at a time. Perhaps, I might not need it for 'Login' purpose, but I have document templates for other purposes. My idea is to have different forms (can this be considered as document template?) for different purposes...something like forms in Visual Basic. So, when user click on a menu item, the specific form for that would be loaded, and the existing form would be unloaded, and only a single form would be displayed at a time. How can I do that?
0
 
LVL 16

Expert Comment

by:AlexNek
ID: 6948877
I think, that easy solution (as SDI+reloading) is to use MDI application with single opened form limited. But I try to find a better solution for you.
What do you mean under the "Form". Which kind of information do you need on? Is there input fields?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:sweetgirl
ID: 6950053
The "Form" I meant is s/thing like having multiple document templates that have controls such as edit box and buttons. I have learnt how to load the specific template during run-time. For a MDI app, it would be OK, but if the same technique is used in a SDI app, it would load a different window that holds that template, which acts as a child of the main window. So, when the parent window closes, the child window closes as well. All I want is a SDI app that could dynamically load 1 document template at a time, in the same window, during run-time. Logically, the current template would need to be unloaded so that the other document template could replace it in a SDI app.
0
 
LVL 16

Expert Comment

by:AlexNek
ID: 6951904
It seems that you need different selectable groups of user input. It look like Property Pages in dialog. Why you don't want to use this way?
Or probably it is possibly (I must check it) that you reload only View but not the whole Doc-View-Frame.
0
 
LVL 16

Expert Comment

by:AlexNek
ID: 6951956
Easy view reloading seems not be possible. You can try to create series of Modeless dialog boxes like in CFormView and manage it yourself (Hide/Show).
0
 

Author Comment

by:sweetgirl
ID: 6952930
What do u mean by creating series of Modeless dialog boxes like in CFormView? I thought dialog boxes belongs to CDialog class, which is different from CFormView class! If I have not mistaken, a menu bar can be attached to a dialog box. So, perhaps creating a dialog box application with the menu bar would be essential for my purpose, since dialog boxes can be managed through Hide/Show. In a SDI/MDI application, during runtime, how do I close that view? What method would perform this function?
0
 
LVL 16

Accepted Solution

by:
AlexNek earned 200 total points
ID: 6953295
>What do u mean by creating series of Modeless dialog boxes like in CFormView.

If you look in source code, CFormView create a modeless dialog. My trick-idea was that you can load over old View your new form from resource as modeless dialog. Then hide old.

If you can accept dialog with menu bar it will be better idea. Note: CDialog and Dialog template in resource it is not the same. Dialog template you can use in other classes.

For dialog mode:
You can use Property pages (sub dialogs in dialog), you can use Left-Right Panels (Left panel contain list of all dialogs, right - current dialog) or Wizard mode (one dialog after other).
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Screencast - Getting to Know the Pipeline
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question