Solved

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

Posted on 2002-04-13
10
155 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
10 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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 50 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
This video discusses moving either the default database or any database to a new volume.

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now