Solved

displaying child windows(URGENT)

Posted on 2000-05-04
9
176 Views
Last Modified: 2013-11-20
Hi,
   I have devised an application,whereby on pressing a toolbar button one view should be displayed as a child view. I have five toolbar buttons and i want it to display five different forms on pressing each of the toolbar. All these forms should be child forms.
I have submit the application tommorrow
Please help me in this regard.

Thanx,
Thiru
0
Comment
Question by:thirumaran
[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
9 Comments
 

Expert Comment

by:hchopra
ID: 2778253
You could create an MDI application with multiple doc templates. Each doctemplate could have a differnetn view attached to it. Thus you could have five different view types (eg form view, list view etc) associated with the same document. you can then handle the commands from the tool bar buttons and display and destroy the views accordingly.
 
Certainly feasible but a little difficult in one day.
0
 

Author Comment

by:thirumaran
ID: 2779430
Please explain it and give me the source code for it
Thanx,
Thiru
0
 
LVL 12

Expert Comment

by:migel
ID: 2779890
Hi!
hm you can do it in the SDI application:
just in the MainFrame window add 5 pointers to the needed views and one to hold currently active view.
After application is open MainFrame show view that was described in the AddDocTemplate() statement of the CApp::InitApplication()...
in the CMainWnd add handlers to the switch view commands. In this handlers check what view must be displayed and then hide current active view (by m_pActiveView->ShowWindow(SW_HIDE), and display needed view.

for example:
// we need second view
if (!m_pViewsArr[1])
{
m_pViewsArr[1] = new CMyView2(..);
if (!m_pViewsArr[1])
return;
m_pViewsArr[1]->Create(...);
}

m_pViewsArr[1]->ShowWindow(SW_SHOW);
0
Technology Partners: 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!

 
LVL 12

Accepted Solution

by:
migel earned 40 total points
ID: 2779899
ooops it must be comments :-)
0
 

Author Comment

by:thirumaran
ID: 2780323
Hi migel,
   Cud u please elaborate a bit on it and if possible give me the exact source code for it.

Thanx,
Thiru
0
 
LVL 12

Expert Comment

by:migel
ID: 2780398
hm,
can you send me your test project?
this code too big to paste into the forum edit :-).
my Email:
migel.geo@yahoo.com
0
 

Expert Comment

by:JohnPhelps
ID: 2780905
Hi,

If I understand the request, you have one "main" form and want to be able to show 5 sub/child forms. If this is correct, pls carry on reading.

I had a database app. where I would show the BLOB's in the db in individual child windows.

This was achieved by :
In my view class, I created the child windows -:
pImgWnd[i] = new CImgWindow(); (Derived from CWnd)

Initialised the child window variables to determine the image type and displayed the window -:
if (pImgWnd[i]->nImgType == DAO_FORMAT){
            pImgWnd[i]->m_DAOPicture.m_hData = m_pSet->pImgArray[i]->m_hData;
            pImgWnd[i]->m_DAOPicture.m_dwDataLength = m_pSet->pImgArray[i]->m_dwDataLength;
      }

pImgWnd[i]->Create(NULL, WinTitle, WS_CHILD, pImgWnd[i]->WindowPos, this,
            NULL, NULL);

In your case you could create & destroy the child windows in response to the toolbar buttons, which would be mapped to your view class.

If this code will help, mail me at jphelps@global.co.za or johnp@delarue.co.za
0
 

Author Comment

by:thirumaran
ID: 2809285
Adjusted points from 30 to 40
0
 

Author Comment

by:thirumaran
ID: 2809289
Thanx a lot for the help which you provided.

Thiru
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

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…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

734 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