Solved

pseudo-MDI application

Posted on 1997-07-16
3
222 Views
Last Modified: 2013-11-20
I would like to have an application that consists of several
types of documents and views and the views can be seen
together and arranged with the automatic "cascade" and "tile" features you get with MDI.
The problem is, I do not want it to be MDI, i.e. only
one document of each type may exist.
How can I do that ?
0
Comment
Question by:mco
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Expert Comment

by:mbhakta
ID: 1302603
If you are thinking you cannot achieve blocking more than one instance of a view or a document then you should reconsider. There are ways where you can check if a particular document has already been opened by another view. This can be done on a file basis as well as on a C++ object basis. This can be also implemented for views.

Yes, this can be also done without using MDI and instead using SDI or a group of CWnd's (like VB 4.0 does) but this is not clean and often lands with heaps of extra code which would have already been written by MS for a MDI interface.

It is a decision you should make whether you can live with MDI and get the  problem you have sorted out or re-write some  code to get it working on a SDI or worst a dialog based application.

If u come up with more precise details about your problem I will be here to help you.
0
 
LVL 1

Author Comment

by:mco
ID: 1302604
Your answer was general. I was expecting something more specific.
Let me rephrase: I will start it off as an MDI (in order for
Visual C++ do all the work related to the "tile" and "cascade"
features).
How do I prevent another instance of a document (not a view)
to be created.
If you give specific sample code lines, I'll give you an A.

0
 
LVL 4

Accepted Solution

by:
mbhakta earned 100 total points
ID: 1302605
Here is an algorithm : - Start from the active view- Iterate through all the visible (opened) views in the MDI application. Use GetNextView().- Get the document pointer for the view pointer returned from the previous call. - Use IsKindOf() call to check whether the document belongs to a particular class. Keep the count in memory. - Go to the next view. Repeat the previous step. If the counter for that view is more than 1 , that's it you have found another instance of the same doc. Kill that view.Apply this procedure even when a new view is opened. This can go in the OnInitialUpdate() where the view checks for the counter (can be located in theApp). Perform the step 3 and 4 if found.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

696 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