Click to See Complete Forum and Search --> : Why my view doesn't work first?


vico n
July 20th, 1999, 08:06 PM
Hello All:
I Use splitter window in SDI application. I wrote code in Mainframe::OnCreateClient like this:
// m_hSplitter is a CSplitterWnd object
if(!m_hSplitter.CreateStatic(this,1,2)) return false;
if(!m_hSplitter.CreateView(0,1,pContext->m_pNewViewClass,CSize(0,0),pContext)) return false;
// m_hMywnd is m_hSplitter's child windows
m_hMywnd.Create(...);
m_hSplitter.SetColumnInfo(0,100,0);
m_hSplitter.SetColumnInfo(1,200,0);
m_hSplitter.RecalcLayout();

My Splitter Window can display successfully.But Menu's Items which I wrote code for View is disabled untill I click the View client area. Is it possible let the items enabled when application start? thanks for any advice.

nvc

Paul Burns
July 20th, 1999, 10:55 PM
The reason the menu items are only enabled when you click on the view is because the handler's for them are in the view class. To make them available no matter what view is active then move all the handlers into the mainframe class.

Masaaki
July 20th, 1999, 11:21 PM
Hi.

Accroding as Visual C++ developers jounal, www.vcdj.com,
Davide Marcato answered this kind of questions, but MDI with splitter
window.

Even though menu command leaves at View class, he added OnCmdMsg fun
to CChildFrame.

I think that this will work on SDI Application.
Try to check this.

HTH.
-Masaaki Onishi-