chowdry
asked on
Aligning splitter windows
Hi experts :-)
I have a splitter window made of CScrollView & CEditView. But the windows are not equally splitted. I want the windows to be splitted equally even when it's resized. i.e, maximize and restore.
Also I would like to align(center) the buttons in cformview.
regards
P R A T H A P
I have a splitter window made of CScrollView & CEditView. But the windows are not equally splitted. I want the windows to be splitted equally even when it's resized. i.e, maximize and restore.
Also I would like to align(center) the buttons in cformview.
regards
P R A T H A P
There is no easy way of achieving this. I would look at adding some code to reposition the splitter when the frame has been resized then do a recalclayout to force the rest to resize.
ASKER
hi experts :-)
I had tried the following two ways. still it didn't help me.
1st method
---------------
oncreateclient()
{
CRect rect;
GetClientRect( &rect );
BOOL rtn = msplitwnd.CreateStatic(thi s, 2, 1);
rtn |= msplitwnd.CreateView(0, 0, RUNTIME_CLASS(CSecondView) , CSize(rect.right/2, rect.bottom/2 ), pContext);
rtn |= msplitwnd.CreateView(1, 0, RUNTIME_CLASS(CSplitwndVie w), CSize(100, 100), pContext);
}
2nd method
oncreate()
{
m_wndToolBar.GetWindowRect ( &toolrect );
ScreenToClient( toolrect );
m_wndStatusBar.GetWindowRe ct( &statusrect );
ScreenToClient( statusrect );
rect.bottom = rect.bottom ( toolrect.bottom + statusrect.bottom );
msplitwnd.SetRowInfo( 0 , rect.bottom , 0 );
msplitwnd.RecalcLayout();
}
regards
P R A T H A P
I had tried the following two ways. still it didn't help me.
1st method
---------------
oncreateclient()
{
CRect rect;
GetClientRect( &rect );
BOOL rtn = msplitwnd.CreateStatic(thi
rtn |= msplitwnd.CreateView(0, 0, RUNTIME_CLASS(CSecondView)
rtn |= msplitwnd.CreateView(1, 0, RUNTIME_CLASS(CSplitwndVie
}
2nd method
oncreate()
{
m_wndToolBar.GetWindowRect
ScreenToClient( toolrect );
m_wndStatusBar.GetWindowRe
ScreenToClient( statusrect );
rect.bottom = rect.bottom ( toolrect.bottom + statusrect.bottom );
msplitwnd.SetRowInfo( 0 , rect.bottom , 0 );
msplitwnd.RecalcLayout();
}
regards
P R A T H A P
ASKER
Edited text of question
ASKER
Adjusted points to 25
Have you tried creating them both with the same size say (10,10)
ASKER
yes, first I had tried with CSize(100, 100). Since the windows(panes) are not equally distributed (or) splitted, I had tried the other methods.
Adjust points to 50, and I will help.
ASKER
hi speedy,
Iam waiting for u'r answer.
regards
P R A T H A P
Iam waiting for u'r answer.
regards
P R A T H A P
I've just had to do something simliar and setting both size to Rect.W1dth()/2 during creation worked? ie both my tree and my list view were initially the same size! heres the code I used (which does look much like you were doing anyway!
m_HorizontalSplitter.Creat eStatic( m_pFrameWnd,1,2);
m_HorizontalSplitter.Creat eView( 0,0,
RUNTIME_CLASS( ExclTreeView ),
CSize(FrameRect.Width()/2, 10),
NULL);
m_HorizontalSplitter.Creat eView( 0,1,
RUNTIME_CLASS( ExclListView ),
CSize(FrameRect.Width()/2, 10),
NULL);
m_pFrameWnd->RecalcLayout( );
m_HorizontalSplitter.Creat
m_HorizontalSplitter.Creat
RUNTIME_CLASS( ExclTreeView ),
CSize(FrameRect.Width()/2,
NULL);
m_HorizontalSplitter.Creat
RUNTIME_CLASS( ExclListView ),
CSize(FrameRect.Width()/2,
NULL);
m_pFrameWnd->RecalcLayout(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.