Floating toolbars
Severino Delaurenti -- del@alpha.ico.olivetti.com Thursday, December 12, 1996 Environment: Win95, VC++ 4.2b (I have MSDN) Hi all, I have created a floating toolbar associated to my view: what I need is = to obtain the pointer to the Mini Frame Wnd that contains the toolbar = itself, to perform some customization. The toolbar of class CMyPalette is created using the following code: int CMyView::OnCreate (LPCREATESTRUCT lpCreateStruct)=20 { CMainFrame *pMainFrame =3D (CMainFrame *) AfxGetMainWnd (); c_pwndAnnPalette =3D new CMyPalette; if (!c_pwndAnnPalette->Create (pMainFrame, WS_VISIBLE | WS_CHILD | CBRS_SIZE_FIXED | CBRS_TOOLTIPS) || !c_pwndAnnPalette->LoadToolBar (IDR_ANN_TOOLBAR)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } CString str; str.LoadString (IDS_ANN_PALETTETITLE); c_pwndAnnPalette->SetWindowText (str.GetBuffer (1)); c_pwndAnnPalette->EnableDocking (0); CPoint pt (GetSystemMetrics (SM_CXSCREEN) - 150, GetSystemMetrics (SM_CYSCREEN) / 3); pMainFrame->FloatControlBar (c_pwndAnnPalette, pt); return 0; } I've tried to use c_pwndAnnPalette->GetParent () but what I've obtained = is a pointer to the MainFrame. Any suggestion ?? Thanks in advance Severino Delaurenti del@alpha.ico.olivetti.com Olivetti Lexikon Spa Italy
Roma -- roma@neonet.lv Sunday, December 15, 1996 [Mini-digest: 3 responses] Severino Delaurenti wrote: > > Environment: Win95, VC++ 4.2b (I have MSDN) > > Hi all, > > I have created a floating toolbar associated to my view: what I need is to obtain the pointer to the Mini Frame Wnd that contains the toolbar itself, to perform some customization.< I believe CWnd::GetParentFrame() will do this. -Roman -----From: Brijesh Kumar MishraSeverino Delaurenti wrote ------------------------------------------------------------------------ ---------------------------------------------------------- I have created a floating toolbar associated to my view: what I need is to obtain the pointer to the Mini Frame Wnd that contains the toolbar itself, to perform some customization. The toolbar of class CMyPalette is created using the following code: int CMyView::OnCreate (LPCREATESTRUCT lpCreateStruct) { CMainFrame *pMainFrame = (CMainFrame *) AfxGetMainWnd (); c_pwndAnnPalette = new CMyPalette; if (!c_pwndAnnPalette->Create (pMainFrame, WS_VISIBLE | WS_CHILD | CBRS_SIZE_FIXED | CBRS_TOOLTIPS) || !c_pwndAnnPalette->LoadToolBar (IDR_ANN_TOOLBAR)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } CString str; str.LoadString (IDS_ANN_PALETTETITLE); c_pwndAnnPalette->SetWindowText (str.GetBuffer (1)); c_pwndAnnPalette->EnableDocking (0); CPoint pt (GetSystemMetrics (SM_CXSCREEN) - 150, GetSystemMetrics (SM_CYSCREEN) / 3); pMainFrame->FloatControlBar (c_pwndAnnPalette, pt); return 0; } I've tried to use c_pwndAnnPalette->GetParent () but what I've obtained is a pointer to the MainFrame. ------------------------------------------------------------------------ ---------------------------------------------------------- The CControlBar class has a funtion called GetDockingFrame() that returns the pointer to the minframe window that contains the control bar (here it is toolbar). This will solve your problem. - brijesh -----From: =?iso-8859-1?Q?Gunnar_=D6rn_Rafnsson?= 1. Usually controlbars (toolbars, dialogbars, etc.) are members of the = MainFrame not the View because the bars are Docked inside the = MainFrame=B4s space (this applies to SDI, in MDI bars can be docked = either into MainFrame or ChildFrame) 2. The answer to your question is to use CControlBar::GetDockingFrame.=20 CFramWnd *pFrame =3D c_pwndAnnPalette->GetDockingFrame(); Gunnar =D6rn Rafnsson Taugagreining hf Armuli 7b Reykjavik Iceland E-mail : gor@nervus.is WWW : http://www.nervus.is/gor/ ---------- From: Severino Delaurenti[SMTP:del@alpha.ICO.Olivetti.Com] Sent: 16. desember 1996 11:32 To: 'Lista MFC' Subject: Floating toolbars Environment: Win95, VC++ 4.2b (I have MSDN) Hi all, I have created a floating toolbar associated to my view: what I need is = to obtain the pointer to the Mini Frame Wnd that contains the toolbar = itself, to perform some customization. The toolbar of class CMyPalette is created using the following code: int CMyView::OnCreate (LPCREATESTRUCT lpCreateStruct)=20 { CMainFrame *pMainFrame =3D (CMainFrame *) AfxGetMainWnd (); c_pwndAnnPalette =3D new CMyPalette; if (!c_pwndAnnPalette->Create (pMainFrame, WS_VISIBLE | WS_CHILD | CBRS_SIZE_FIXED | CBRS_TOOLTIPS) || !c_pwndAnnPalette->LoadToolBar (IDR_ANN_TOOLBAR)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } CString str; str.LoadString (IDS_ANN_PALETTETITLE); c_pwndAnnPalette->SetWindowText (str.GetBuffer (1)); c_pwndAnnPalette->EnableDocking (0); CPoint pt (GetSystemMetrics (SM_CXSCREEN) - 150, GetSystemMetrics (SM_CYSCREEN) / 3); pMainFrame->FloatControlBar (c_pwndAnnPalette, pt); return 0; } I've tried to use c_pwndAnnPalette->GetParent () but what I've obtained = is a pointer to the MainFrame. Any suggestion ?? Thanks in advance Severino Delaurenti del@alpha.ico.olivetti.com Olivetti Lexikon Spa Italy
| Вернуться в корень Архива |