Solved

displaying child windows(URGENT)

Posted on 2000-05-04
9
174 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
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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 95
notReplace  challenge 53 125
How to convert MFC::CString to UTF8 wchar_t* 10 201
Trying to run powershell  in a batch file. How do I do this? 8 89
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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

813 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

19 Experts available now in Live!

Get 1:1 Help Now