Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • Last Modified:

displaying child windows(URGENT)

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
thirumaran
Asked:
thirumaran
1 Solution
 
hchopraCommented:
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
 
thirumaranAuthor Commented:
Please explain it and give me the source code for it
Thanx,
Thiru
0
 
migelCommented:
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
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
migelCommented:
ooops it must be comments :-)
0
 
thirumaranAuthor Commented:
Hi migel,
   Cud u please elaborate a bit on it and if possible give me the exact source code for it.

Thanx,
Thiru
0
 
migelCommented:
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
 
JohnPhelpsCommented:
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
 
thirumaranAuthor Commented:
Adjusted points from 30 to 40
0
 
thirumaranAuthor Commented:
Thanx a lot for the help which you provided.

Thiru
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now