|
In your function:
TAB_XMARGIN
TAB_YMARGIN
VIEW_XMARGIN
VIEW_YMARGIN
are all undefined.
|
|
|
|
|
They just are placeholders ..
Just put whatever value/CONSTANT/variable you need/want...
|
|
|
|
|
I think here is a copy and paste error:
crect.DeflateRect(TAB_XMARGIN,VIEW_YMARGIN,TAB_XMARGIN,TAB_YMARGIN);
I replaced that with TAB_YMARGIN which worked fine.
|
|
|
|
|
Thanks for useful code. There are two small issues with controlbar when it is floating. The first one appears when closing main app, the second one when closing floating bar and focus was set in one of its view. The possible solution for first problem is to dock bar before exit:
void CMainFrame::OnClose()
{
if(m_wndSTCBar.IsFloating())
DockControlBar(&m_wndSTCBar, AFX_IDW_DOCKBAR_LEFT);
CFrameWnd::OnClose();
}
The possible solution to second issue is to set focus to MainFrame view when floating bar is being closed:
void CSizingTabCtrlBar::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
{
if ( IsFloating() && (lpwndpos->flags & SWP_HIDEWINDOW) )
{
CMainFrame *pFrame = (CMainFrame*)GetTopLevelFrame();
pFrame->SetActiveView(pFrame->m_cActiveView);
}
CSizingControlBar::OnWindowPosChanging(lpwndpos);
}
where m_cActiveView is a CView* object that need to be pointed to MainFrame View.
|
|
|
|
|
Is it possible to dock the window to the top or bottom of the frame
|
|
|
|
|
I have used this class, but i am faced with one problem,
I have a SDI application, and i have two other docking views, one on the left, and one in the bottom,
I have to refresh the tree controls, periodically say after every 4-5 seconds, and i access the Doc class, to get the data from there.
The problem is, that it all works fine, however when i click on the left tabcontrol view, the Doc pointer retrieved is NULL, and the application crashes, I cannot guess why a mouse click would cause such a behaviour,
I have also noticed, that if the dockign window is not docked and is floating the click of the mouse will not crash the prob, and the Doc pointer is retrieved correct,
What might be the reason to it ?
I guess it has some ting to do the way messages are routed from the windows ?
|
|
|
|
|
the sizing control tab bar doesn't seem to give up the wheel mouse when i click in another view (CScollView). Any ideas how to make it give up the wheel mouse?
thx steve
|
|
|
|
|
When I click on the X after making the bar float how do I show it again. It doesnt seem to act lick a normal toolbar.
D-MD
|
|
|
|
|
//when you click Button named "show/hide this Wnd"
void CMainFrame::OnButtonInfospace()
{
// TODO: Add your command handler code here
if (m_WndShowHDX.IsWindowVisible() == TRUE)
ShowControlBar(&m_WndShowHDX, FALSE, FALSE); //hide the Wnd
else
ShowControlBar(&m_WndShowHDX, TRUE, FALSE);//show the Wnd
RecalcLayout();
}
void CMainFrame::OnUpdateButtonInfospace(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetRadio(m_WndShowHDX.IsWindowVisible());
}
xiaobin
|
|
|
|
|
Hi, I found <big>it does not work well in VS.net 2003</big> ,It compile well but not run well !May anyone help me to solve it?
Thank you!!
|
|
|
|
|
I found a similar problem.
I open the demo by vs2003 and convert the version by vs2003, I found it works good.
But if I create a new solution by vs2003 and add the CSizingTabCtrlBar into it, it can't work properly when maximizing the window, the size of the tabctrl is wrong.
I can't solve this problem, may anyone know how to do?
3x!
|
|
|
|
|
The update problem of the views is caused occurs because they are given the wrong parent window.
replacing:
if (!pWnd->Create(NULL, NULL, dwStyle, rect, this, 0, pContext))<br />
with
if (!pWnd->Create(NULL, NULL, dwStyle, rect, &m_tabctrl, 0, pContext))
solves the problem.
http://www.codeguru.com/mfc/comments/27713.shtml
|
|
|
|
|
Right, but requires also a small change in layout in OnSize. Here a full OnSize function (with a change from post above and new positions)
void CSizingTabCtrlBar::OnSize(UINT nType, int cx, int cy)
{
CSizingControlBar::OnSize(nType, cx, cy);
int bottom = (IsHorzDocked() || IsFloating()) ? cy - 14 : cy - 18;
m_tabctrl.MoveWindow(7, 7, cx - 14, bottom);
CWnd *pWnd;
for (POSITION pos=m_views.GetHeadPosition(); pos; m_views.GetNext(pos))
{
pWnd=m_views.GetAt(pos)->pWnd;
pWnd->MoveWindow(2, 9, cx-21, bottom-36);
}
}
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
this change is ok, but what if the font changes? or the tab size changes? a better fix would be:
void CSizingTabCtrlBar::OnSize(UINT nType, int cx, int cy)<br>
{<br>
CSizingControlBar::OnSize(nType, cx, cy);<br><br>
int bottom = (IsHorzDocked() || IsFloating()) ? cy - 14 : cy - 18;<br><br>
m_tabctrl.MoveWindow(7, 7, cx - 14, bottom);<br><br>
CRect r;<br>
m_tabctrl.GetClientRect(&r);<br>
m_tabctrl.AdjustRect(FALSE, &r);<br><br>
CWnd *pWnd;<br>
for (POSITION pos=m_views.GetHeadPosition(); pos; m_views.GetNext(pos))<br>
{<br>
pWnd=m_views.GetAt(pos)->pWnd;<br>
pWnd->MoveWindow(r.top, r.left, r.Width(), r.Height());<br>
}<br>
}<br>
Andy
|
|
|
|
|
|
resource.h include it, but compile error...
what is IDW_PROP_BAR , where is it?
thanks!
Great C++!
|
|
|
|
|
IDW_PROP_BAR is the name of the Tab Control Identifier, and it appears in "resource.h" and CMainFrame::OnCreate.
When the Tab Control is being created, it needs to have a name that will identify it, which is what IDW_PROP_BAR is. It could have been any name, but that's the one the person writing the program chose.
William
Fortes in fide et opere!
|
|
|
|
|
At the last line of:
void CSizingTabCtrlBar::OnSize(UINT nType, int cx, int cy)
At the following line: Invalidate();
To prevent the defect in the border while enlarging the control.
|
|
|
|
|
HI, everybody?
I'm a beginner at mfc..
I think it is very useful code!!
It is compiled and build very well..
But,I can't use it..
Because it doesn't work and show following error message..
//"Debug Assertion Failed!!"
//"File name : barcore.cpp"
//"Line : 987"
And the line 987 above is followed..
ASSERT((m_dwStyle & CBRS_ALL) == m_dwStyle);
So I don't know how to debug it..
Would you , professional programer, please help me?;)
I'll be waiting for reply..
PS : I use microsoft Visual C++ 6.0 compiler.
I Downloaded sourcecoed(46k) and compiled without any change.
|
|
|
|
|
Hi ParkSK,
Try to do following:
BOOL CSizingControlBar::Create(CWnd* pParentWnd, CSize sizeDefault, UINT nID, DWORD dwStyle)
{
ASSERT_VALID(pParentWnd); // must have a parent
ASSERT (!((dwStyle & CBRS_SIZE_FIXED) && (dwStyle & CBRS_SIZE_DYNAMIC)));
// save the style
// m_dwStyle = dwStyle;
dwStyle &= ~CBRS_ALL;
dwStyle |= CCS_NOPARENTALIGN|CCS_NOMOVEY|CCS_NODIVIDER|CCS_NORESIZE;
m_sizeHorz = sizeDefault;
m_sizeVert = sizeDefault;
m_sizeFloat = sizeDefault;
CString wndclass = AfxRegisterWndClass(CS_DBLCLKS, LoadCursor(NULL, IDC_ARROW),
CreateSolidBrush(GetSysColor(COLOR_BTNFACE)), 0);
bool bTest = ((m_dwStyle & CBRS_ALL) == m_dwStyle);
if (!CWnd::Create(wndclass, NULL, dwStyle, CRect(0,0,0,0),
pParentWnd, nID))
return FALSE;
return TRUE;
}
That means to comment the line 'm_dwStyle = dwStyle;' which saves the style in advance.
Jawid
|
|
|
|
|
Thank you very much.
Just two slashes(//) make it great!!
|
|
|
|
|
Thx, it works for me too !
Thank U again
Gremy
|
|
|
|
|
I had met the same problem. After I make the change mentioned in Jawid's article, it works correctly.
But when use the CSizingTabCtrlBar in a SDI, it did not work properly!
when the main window shows first time, the CFielView and the CClassView do not show. I must resize the window to show them. And still, when the main window was resized the docking bar did not resized!
I am puzzled by the problem. Would any MFC experts likes to help me?;P
Thanks in advance.
Do not accept failure without trying.
|
|
|
|
|
I used this class and created it ,but a problem followed sequently.My listview's functions will not work except it was called inside my listview class.For example,when i call InsertItem(...)inside my listview ,it is normal.but if i use GetActiveView()->m_pListCtrl->InsertItem(...) in my mainframe,it doesn't work.
if i don't created this control ,then everything was ok!a strange problem ,who can help me?
i am coming quietly just as i am leaving quietly.
|
|
|
|
|
Hi. I've sort of mixed this class with the newer CSizingControl bar instead of the one you had. The question I had is where are you redrawing the client area. As I have it now I'm getting a rather interesting side affect as demonstrated in this screenshot:
http://fote.dune.net/bad.gif
Whats even odder about it is that it only happens when enlarging the view. If you size it smaller the client area is redrawing just fine. So anyway hoping you can answer this one Thanks.
|
|
|
|
|