|
-
March 15th, 2011, 04:07 PM
#1
Stretch a docked CDialogBar.
I'm feeling pretty dumb right now, but I can't seem to get my docked CDialogBar to stretch the length of a window. I want my dialog bar to be docked to the top (the user can't change this). In the dialog bar, I want certain controls to be anchored to the right side of the dialog. So when the window stretches, I want the dialog bar to stretch as well. However my CDialogBar derivative isn't receiving the WM_SIZE message when the frame window is resized.
In my frame's OnCreate method (it's a frame not using doc/view architecture), I have the following code:
Code:
m_bar.Create( this, IDD_DIALOG1, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_SIZE_FIXED, IDD_DIALOG1 );
m_bar.EnableDocking( CBRS_ALIGN_TOP );
EnableDocking( CBRS_ALIGN_TOP );
DockControlBar( &m_bar );
Then in my frame's OnSize message handler, I call:
Code:
RepositionBars( IDD_DIALOG1, IDD_DIALOG1, 0 );
I have a CDialogBar derivative that just handles the WM_SIZE message to move child controls, but it's never hit.
What am I doing wrong?
-
March 15th, 2011, 05:42 PM
#2
Re: Stretch a docked CDialogBar.
Well then, send WM_SIZE to dialog bar from the frame's WM_SIZE hander.
-
March 15th, 2011, 06:03 PM
#3
Re: Stretch a docked CDialogBar.
That's what I'm doing now, but that seems like a hack to me.
-
March 16th, 2011, 08:14 AM
#4
Re: Stretch a docked CDialogBar.
 Originally Posted by sjc
That's what I'm doing now, but that seems like a hack to me.
Every attempt to change of default behavior is a "hack". 
To avoid sending WM_SIZE which indeed is not elegant, override CDialogBar::CalcFixedLayout and force bStretch to TRUE.
Code:
CSize CMyDialogBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
{
if(!IsFloating())
{
bStretch = TRUE;
}
return CDialogBar::CalcFixedLayout(bStretch, bHorz);
}
Last edited by ovidiucucu; March 16th, 2011 at 08:38 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|