Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I attach a menu and a toolbar to a SDI app?

Status
Not open for further replies.

real

Programmer
Jan 20, 2001
15
US
Im new to this and I am having trouble with attaching a toolbar and a menu to a SDI app. Can anyone guide me in the right direction or suggest anything for me to do. thanks in advance....charles
 
have you read MSDN? John Fill
1c.bmp


ivfmd@mail.md
 
Since you are using Doc View, you need not write much code as far as user interface is concerned.

Go to resource editor and add menus/toolbars and give appropriate IDs.

Later write code for handling of the task when the user selects a menu/toolbar.

Hope this helps.

T. Rajeswari
 
If you make a SDI or MDI project the wizard will write the code necesary for a toolbar.Just look in the OnCreate message handler(method) of the CMainFrame class. There you can find the code for handling the status bar. It should look like:

if (!m_wndToolBar.Create(this) ||!m_wndToolBar.LoadToolBar(IDR_TOOLBAR))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
//m_wndStatusBar.SetPaneInfo(1, ID_SEPARATOR, SBPS_NORMAL, 195);
//m_wndStatusBar.SetPaneInfo(2, ID_SEPARATOR, SBPS_NORMAL, 145);
//m_wndStatusBar.SetPaneInfo(4, ID_SEPARATOR, SBPS_NORMAL, 45);
m_wndStatusBar.SetPaneInfo(CMyMDIFrameWnd::eMyConstant1,
ID_SEPARATOR, SBPS_NORMAL, 300);

m_wndStatusBar.SetPaneInfo(CMyIFrameWnd::eMyConstant2,
ID_SEPARATOR, SBPS_NORMAL, 200);

m_wndStatusBar.SetPaneInfo(CMyIFrameWnd::eMyConstan3,
ID_SEPARATOR, SBPS_NORMAL, 100);

// TODO: Remove this if you don't want tool tips or a resizeable toolbar
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
-----------------------------------------------------------
m_wndToolbar and m_wndStatusBar are member of CMainFrame.

For the frame menu the coresponding code you can find in the Initinstance of your CWinApp derived class,. It should look like this:

CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;

Hope this helps, s-)

Blessed is he who in the name of justice and good will, shepards the week through the valley of darkness...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top