|
//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.
|
|
|
|
|
Ok in case this might help anyone I found that by placing pWnd->BringWindowToTop(); in the resizing loop it seems to clear up the problem.
|
|
|
|
|
I got the same problem, what resizing loop are you referring to?? Which file/function?
|
|
|
|
|
I think I found it in the derived class OnSize loop, this works but gets understandably terrible flashing when resizing. Is there a better solution?
|
|
|
|
|
This is what I did because I was having problems with both it not drawing when I sized it bigger (or small size decreases) and not redrawing correctly after being sized smaller.
In the OnSize function...
//pWnd->MoveWindow(9, 9, cx-19, bottom-26); //Replaced with:
pWnd->SetWindowPos(&wndTop, 9, 9, cx-19, bottom-26, NULL);
pWnd->RedrawWindow();
This made it work correctly.
-Brett
|
|
|
|
|
I can't run it. It dumped failed info when creat CSizingControlBar
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);
if (!CWnd::Create(wndclass, NULL, dwStyle, CRect(0,0,0,0),
pParentWnd, nID)) //Dump the failed info here!
return FALSE;
return TRUE;
}
|
|
|
|
|
Hello,
change AddView
// save the style
//m_dwStyle = dwStyle;
m_dwStyle = dwStyle & CBRS_ALL;
|
|
|
|
|
I work under win2k.
I had did and application with CsizingControl Bar and CSizingTABControl Bar; when i REDRAW the TAB control bar, the treeView selected (CClassView or CFileView) didn't appear on the bar. The bar is only grey!!
Can you help me please?'!!??
A.C.
|
|
|
|
|
Adding pWnd->BringWindowToTop(); to the sizing loop seems to correct the problem.
|
|
|
|
|