![]() |
Codejock alternative to CDialogBar |
Post Reply ![]() |
Author | |
CyberSky ![]() Groupie ![]() Joined: 15 February 2010 Status: Offline Points: 15 |
![]() ![]() ![]() ![]() ![]() Posted: 11 April 2010 at 8:34pm |
My program uses a docked CDialogBar for a "control panel" along the left or right size of the window. I want to replace this with a nicer-looking Codejock alternative, such as a docking pane or CXTPDialogBar. My problem is that unlike the standard MFC CDialogBar, neither of the alternatives automatically size themselves to the dialog template.
I checked the samples, and CommandBars.ActionsSample uses a CXTPDialogBar, and it looks okay when I first run the program, but if I resize the dialog and then rebuilt the program, the dialog bar's controls are cut off by the window's edge. I also tried using docking panes but have the same trouble. I know about the SetSize() method but can't seem to programmatically determine the size that I need to pass so that the entire dialog appears in the pane with even margins around it.
If anybody has dealt with this and could give me some pointers, I'd be grateful. Maybe it's obvious, but I'm really frustrated right now and a bit worried. Using the Codejock product has been more work than I imagined, but so far I've eventually managed to make things work.
Am using VS2008 on Windows 7 64-bit, Xtreme Toolkit Pro 13.3.1.
|
|
![]() |
|
Hieracosphinx ![]() Newbie ![]() ![]() Joined: 22 January 2010 Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() |
I had the exact same problem and have just solved it. The solution that works for me is to restore the template size to the CXTPDialogBar after loading the command bars from registry or serialized storage.
My structure to support this: 1. derive CMyDlgBar from MFC CDialog. CDialogBar does not seem to work in all kinds of ways. (I am on VS 2002, MFC 7.) You will need access to the template size so: BOOL CMyDlgBar::OnInitDialog(CDataExchange* pDX) { . . CRect rc; GetWindowRect(rc); ScreenToClient(rc); m_size = rc.Size(); . . } CSize CMyDlgBar::GetSize() { return m_size: } 2. Add a dockbar (CXTPDialogBar) to CommandBars, connecting my bar as child, then set the size. void CMainFrame::CreateBar(int nID, LPCTSTR name, CMyDlgBar* pDlgBar, BOOL hideAtStart) { CXTPCommandBars* pCommandBars = GetCommandBars(); CXTPDialogBar* pBar = (CXTPDialogBar*)pCommandBars->Add(name, xtpBarTop, RUNTIME_CLASS(CXTPDialogBar)); pBar->SetBarID(nID); pBar->EnableDocking(xtpFlagAlignTop|xtpFlagAlignBottom|xtpFlagStretched); pBar->ModifyStyle(0, WS_CLIPCHILDREN|WS_CLIPSIBLINGS); pBar->SetCloseable(FALSE); pBar->SetResizable(FALSE); pDlgBar->Create(pBar); pDlgBar->ShowWindow(SW_SHOW); pBar->SetChild(pDlgBar); pBar->SetSize(pDlgBar->GetSize()); // Note, this only changes the height of a docked bar. pBar->SetVisible( ! hideAtStart); } 3. Each time you load the command bars from storage, the dock size may be old so you will need something to reset it after loading: (I have a workspace library for users to create their own layouts.) void CMainFrame::SetSizeDlgBarDockToTemplate(int nDockID, CMyDlgBar* pDlgBar) { CXTPCommandBars* pCommandBars = GetCommandBars(); CXTPDialogBar* pBar = (CXTPDialogBar*)pCommandBars->GetToolBar(nDockID); CSize sz = pDlgBar->GetSize(); pBar->SetSize(sz); } Hope this helps. ![]() |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |