Solved

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

Posted on 2002-04-13
10
176 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand LInux Boot partition remotly 3 90
WinWaitActive parameters 12 31
building a service to accessed via telnet client, want colors ? 4 88
matchUp  challenge 9 105
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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.

808 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