|
|
Comments and Discussions
|
|
 |
|

|
I have read the MFC source code of the following function:
void CFrameWnd::EnableDocking(DWORD dwDockStyle);
A CDockBar object is allocated in heap:
pDock = new CDockBar
but where the object is freed? Is is memory leak?
There is a will,there is a way!
|
|
|
|

|
I agree with you ,How do you solve it?
|
|
|
|

|
There isn't any memory leak here. The main frame keeps an array of control bar pointers, and deletes them when it is destroyed.
Steve Wolf
|
|
|
|

|
There is a Class derive from the CSizingControlBarG.
Now I want to control the bar,make its width less than 200.Whether it is docking or floating.I get the window poiniter and moveWindow().Its postion is Changed,but the size is not Changed.How Can I do?
|
|
|
|
|

|
Hi I tried to use this control in myapp in VS2008, here is the code I use:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndMyLog.Create(" Error log", this, CSize(640, 60),
TRUE, AFX_IDW_CONTROLBAR_FIRST + 34))
{
TRACE0("Failed to create mylog\n");
return -1; }
m_wndMyLog.SetBarStyle(m_wndMyLog.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
m_wndMyLog.EnableDocking(CBRS_ALIGN_BOTTOM);
EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndMenuBar);
DockPane(&m_wndToolBar);
DockControlBar(&m_wndMyLog,AFX_IDW_DOCKBAR_BOTTOM);
return 0;
}
When I trace it here is where it stops:
void CFrameWnd::DockControlBar(CControlBar* pBar, CDockBar* pDockBar, LPCRECT lpRect)
{
ENSURE_ARG(pBar != NULL);
ASSERT(pBar->m_pDockContext != NULL);
if (pDockBar == NULL)
{
for (int i = 0; i < 4; i++)
{
if ((dwDockBarMap[i][1] & CBRS_ALIGN_ANY) ==
(pBar->m_dwStyle & CBRS_ALIGN_ANY))
{
pDockBar = (CDockBar*)GetControlBar(dwDockBarMap[i][0]);
ASSERT(pDockBar != NULL);
break;
}
}
}
ENSURE_ARG(pDockBar != NULL);
ASSERT(m_listControlBars.Find(pBar) != NULL);
ASSERT(pBar->m_pDockSite == this);
pDockBar->DockControlBar(pBar, lpRect);
}
Any help why is this happening?
Thanks in advance
|
|
|
|

|
Because you are deriving from CFrameWndEx, you're using the newer control bar framework. The newer one is not compatible with this project. You can instead derive from CFrameWnd, and you'll get the older functionality and this project should work (I had to make some very minor corrections to the code to make it compile with VS2010 and VS2012).
Steve Wolf
|
|
|
|

|
After DinamycRecalcSize sizingbar is too width for my control, how can i reduce heigth?
|
|
|
|

|
怎么在Dialog Based application 实现这样的效果呢?有没有人实现过?
|
|
|
|

|
Hi to all,
how I can catch a click or double Click into Treeview on baseCMyBar ?
tanks
Mirko
|
|
|
|

|
I have solved it whit a notification:
ON_NOTIFY(NM_DBLCLK, ID_TREELIBADD, OnNMRclickTreeAdd)
where ID_TREELIBADD is my treeview
Mirko
|
|
|
|

|
Hi anybody there!!!
I have solved the problem last time I encountered!I'd like to share my experience and the way I solved my problem!
The way is as follows:
For " 'static_cast' : cannot convert from 'UINT ...", I find that function and change UINT THAT_FUNCTION(...) to LRESULT THAT_FUNCTION(...).
For " 'afxChNil' : undeclared identifier", find "afxChNil" and put it NULL, it worked just ok for me.
By the way ,I use the compiler VS2005~~~
|
|
|
|

|
I'm trying to add the CSizingControlBar class to my project,but before I compile the demo project downloaded from the site http://www.codeproject.com/KB/toolbars/sizecbar.aspx there are some errors,like:
error C2065: 'afxChNil' : undeclared identifier h:\课程设计\sizecbar_src\src\sizecbar.cpp 1297
error C2440: 'static_cast' : cannot convert from 'UINT (__thiscall CSizingControlBar::* )(CPoint)' to 'LRESULT (__thiscall CWnd::* )(CPoint)' h:\课程设计\sizecbar_src\src\sizecbar.cpp 108
I'm so confused!so I really appreciate it if anyone can give me a hand!
My email:258347328@qq.com
|
|
|
|

|
I have a program that create by MDI. It need a CSizingContralBar show the CListView, and show image in the CChilfFrame.
I have implement a CMyListView class inherit from CListView , and how I show it on the CSizingContralBar. Thanks!
|
|
|
|

|
Has anyone experienced any GDI resource leaks using CSizingControlBar?
Specifically, when using it with MFC's CTreeCtrl?
I may be getting some strange font leaks related to the Font Tahoma (size 8) ?
It happens randomly, so I can't reproduce it. I don't know what causes it.
The controls are always docked when this happens.
I'm using a free tool called GDIUsage:
http://msdn.microsoft.com/en-us/magazine/cc188782.aspx
|
|
|
|

|
Hi,
Thank you for an excellent article. Sizing controlbar is awesome but...
I have a problem with the docked state of the sizing controlbar. I have derived a class from CSizingControlBarG, but I can't get it working right when it is in docked state. 1. I cant resize the bar. 2. I cant grab the bar from the gripper. 3. I cant close the bar from the x. I can do all this when the bar is floating, but I want the bar to be docked all the time.
Thank you already
|
|
|
|

|
Hi,
When I try to compile this library using Microsoft Visual Studio 2005, with Unicode char set, the gripper bar
for docked controls are painted white.
I don't think this problem is related to whether platform is 32-bit or 64-bit. It only appears when project
is compiled for Unicode.
How to fix?
|
|
|
|

|
Has anyone compiled this library for a 64-bit platform? I've successfully compiled it (only had to change GCL_HBRBACKGROUND to GCLP_HBRBACKGROUND),
however, the gripper for docked controls are white! How to fix this problem?
In CSizingControlBar::OnNcPaint(),
I had to change GetClassLong to GetClassLongPtr and also added UlongToPtr.
mdc.FillRect(rcDraw, CBrush::FromHandle( (HBRUSH)UlongToPtr(::GetClassLongPtr(m_hWnd, GCLP_HBRBACKGROUND))));
However, the gripper is still painted white. Any suggestions?
I also have some other warnings. Not sure if they're related to painting:
Compiling...
sizecbar.cpp
.\lib\sizecbar.cpp(267) : warning C4244: 'argument' : conversion from 'INT_PTR' to 'int', possible loss of data
.\lib\sizecbar.cpp(775) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'int', possible loss of data
.\lib\sizecbar.cpp(884) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'int', possible loss of data
.\lib\sizecbar.cpp(920) : warning C4244: '=' : conversion from 'INT_PTR' to 'int', possible loss of data
.\lib\sizecbar.cpp(1001) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'int', possible loss of data
modified on Sunday, May 24, 2009 1:34 AM
|
|
|
|

|
can add resourceo of dialog to CSizingControlBar ? I want have a style like the property Bar of VS2005 !
My english is bad, so....Maybe I can not experss my question >..sorry! But I want your helps!
|
|
|
|

|
Hi, all,
Here I want to create two tabs in one SDI application, I wish the frame look like below:
000000000
000000000
000000000
000000000111111111111111
000000000111111111111111
000000000111111111111111
But using csizingcontrolbar, two tabs are created, but looke like below and can not changed:
000000000
000000000
000000000
111111111111111111111111
111111111111111111111111
111111111111111111111111
Does anyone tell me how to modify??
Regards
-yufeng
Email: logicbean@hotmail.com, yufenghao@gmail.com
|
|
|
|

|
I am also asking the same question.
But I try a method, modefy fuc: CalcFixedLayout, But did not succeed.
|
|
|
|

|
you can try modify funciton NegotiateSpace
|
|
|
|

|
It depends upon the sequence of the calls to EnableDocking(); probably in your CMainFrame class.
To get the first example (illustrated in the question) call:
EnableDocking(CBRS_ALIGN_TOP);
EnableDocking(CBRS_ALIGN_LEFT);
EnableDocking(CBRS_ALIGN_BOTTOM);
EnableDocking(CBRS_ALIGN_RIGHT);
To get the second example change the order as follows:
EnableDocking(CBRS_ALIGN_TOP);
EnableDocking(CBRS_ALIGN_BOTTOM);
EnableDocking(CBRS_ALIGN_LEFT);
EnableDocking(CBRS_ALIGN_RIGHT);
|
|
|
|

|
Hi
Any one experienced that while Floating it captures the mouse messages and make the Main Window disabled.
Where as it releases if we dock it back to main window.
Any help?
VC++,COM ,C#
|
|
|
|

|
Hi, all
I'm a newbie of MFC world.
Here goes my first meaningful reply on CP:
After digging in the code and MSDN( at the very first, in the replies of cource), AND messing up with OnSize() , OnMouseMove() , OnTrackUpdateSize() ... I can't find a acceptable way to accomplish the goal. cos Windows don't send mouse messages the way I thought. And I can't get a WM_GETMINMAXINFO notify of the controlbar, maybe the message pump in the base class just ignored it. A explanation is appreciated!!!
finally I got CalcDynamicLayout() , which I thought is the key. But I can't quite understand the usage of the function, after reading MSDN and the source code I got even more confused
But, hey, the the CalcDynamicLayout() in our base class did the whole mess right? Then, Why just use the value it returned and Only check for the limitation? Here goes:
CSize CNicoSBar::CalcDynamicLayout(int nLength, DWORD dwMode)
{
CSize szRet = myBase::CalcDynamicLayout(nLength, dwMode);
CRect rcClient;
GetDockingFrame()->GetClientRect(rcClient);
if( szRet.cx > rcClient.Width() / 2 )
{
szRet.cx = rcClient.Width() / 2;
}
.
.
.
return szRet;
}
Done!
NOTE: this affects only the docking mode, I still can't find a perfect way to limit the size of it when it is in floating mode. But maybe we hardly needed that feature(hopefully).
modified on Saturday, June 21, 2008 10:29 AM
modified on Saturday, June 21, 2008 10:30 AM
|
|
|
|

|
Really thank you for your information..^^
|
|
|
|

|
I'm glad it helped.
I want to make more friends all over the world.
I love StarCraft and some ACT video games.
MSN: c.nicos@hotmail.com
Welcome to China, Welcome to Beijing!
And don't forget to bring your XBOX 360
pad
|
|
|
|

|
Another thanks for this one. You really saved me alot of time.
|
|
|
|

|
Glad it helped.
After years, a simple message can still help others, that's the beauty of the internet!
BTW, MFC is dead. Why not give .Net a try.
I want to make more friends all over the world.
I love StarCraft and some ACT video games.
MSN: c.nicos@hotmail.com
Welcome to China, Welcome to Beijing!
And don't forget to bring your XBOX 360
pad
|
|
|
|

|
I have created a toolbar derived from CToolBar class.
by default i kept caption of toolbar as some "abc".
i made the toolbar to floating state. then caption shows as abc. thats fine
but when i select any of the menu option i want to change the caption of floating toolbar dynamically.
when the toolbar is docked & brought to floating position caption is changing. But i dont want to dock the toolbar, it should be always be floating. and the title should change when toolbar is in floating.
plz can any one help on this.
|
|
|
|

|
Is there a way Ctrl+A (Select All), Ctrl+C (Copy), Ctrl+V (Paste) ... to start working in a sizebar edit box control (Demo1) when its on focus?
??????????????????????????????
|
|
|
|
|

|
Hello everyone
I have used the CSizingControlBar in my MDI Program;but a Gray Rectange was find in the bar! I don't why it is.
Who can help me!
|
|
|
|

|
Indeed it's a nice tool in VC++. Thanks to bob19672 for providing me the link info. I've utilised the suggestions in getting a dockable bar in my application. But I could not able to implement the to and fro Error Message passing both from Transmit and Receive ends.
I am developping one application in VC++ ver-6.0 using MFC. The Main Frame Window is divided into 2 using CreateStatic function of CSplitterWnd Class , upon one of which a Runtime Class namely CErrMsgView (Base Class CScrollView) is being attched. The other one, ( is again sub-divided into 2 with CreateStatic. Again it is being attached with 2 Run Time classes namely CMainView and CStatView (Base Class CFormView) respectively.
The CErrMsgView Class is meant to capture all the Messages being transferred to and fro. I would like to add an option under the View Menu Heading "Show/Hide ErrMsg View". The Clck on which alternately Show or hide the ErrMsgView. Would You Please Help Me Out.
.
Initially in my application, I have used a Run Time Class ClogView derived from CScrollView and mapped to one SplitterWindow in CMainFrame control all the messaging in my application.
Can You Please tell me how to map the MyBar docked control bar to use as a error message viewer.
Thank You and Best Regards.
Soumen Biswas
|
|
|
|

|
I want to place two CSizingControlBars on the bottom of my main frame, I use the same technique as presented in Demo2 of the downloaded source code: DockControlBar(&m_alarmBar, AFX_IDW_DOCKBAR_BOTTOM); RecalcLayout(); CRect rBar; m_alarmBar.GetWindowRect(rBar); rBar.OffsetRect(1, 0); DockControlBar(&m_eventBar, AFX_IDW_DOCKBAR_BOTTOM, &rBar); The problem is that I can't control the horizonal size of each bar. If I set m_szHorz in ctor of my CSizingControlBarCF descendant, its cy has effect but cx doesn't. The only clue I found is that these two bars are the childs of the same AfxControlBar42d, but I don't know how it affects. I'm not proficient on MFC or Windows GUI programming, any guru could give me a hint? Thanks in advance.
|
|
|
|

|
Hello,
I would like to use this control in a Dialog Based application (Not single/multiple Document application).. Is this possible?
Any hint on how to implement this?
Thanks in advance.
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|

|
Thanks for the nice article.
I have some doubts...Please
How can I change the border color of the CSizingControlBar Window
And also making border thin?
Thanks in adavnce.
rm_pkt
|
|
|
|

|
There is a problem with dialog based mfc applications. in colxpbar.c(1722):
static void APIENTRY CalcPaneHeightsRecursive ( PPANECTRL pPC,
int xorig,
int *pxmin, int *pymin,
int *pxmax, int *pymax,
int iPaneWidthMin, int iPaneWidthMax )
{
SIZE siMin,siMax;
BOOL bUpdated=FALSE;
siMin.cx = siMin.cy = siMax.cx = siMax.cy = 0;
if (pPC->bPDCControl) <- here stops my debugger
i commented out all calls of this function, and now it works.
|
|
|
|

|
I've found it useful to add the following in my own project.
I added a member variable:
BOOL m_bDragLocked; // enabling this causes a docked controlbar to be locked
I added two member functions:
const BOOL CSizingControlBar::IsLocked() const
{
return !IsFloating() && m_bDragLocked;
}
void CSizingControlBar::EnableLock(BOOL bLockDrag)
{
m_bDragLocked = bLockDrag;
}
I changed one line of code:
void CSizingControlBar::OnLButtonDown(UINT nFlags, CPoint point)
{
if (m_pDockBar != NULL && !IsLocked()) // Control may be locked
...
I wouldn't want to add a whole new class for such a small feature but I found it to be useful in my project and highly suggest it as part of the base class implementation. This will allow the control to still be resized but not undocked.
Hope that helped someone,
Ben Quintero
-- modified at 3:02 Wednesday 10th January, 2007
|
|
|
|

|
I have a problem with position of the dockbars. I created three docking bars. one is on the left, one is on the right and the other one is on the bottom. I want to locate three docking bars like this. --------------------------- │ │ │ │ │ │ │ │ │bar1 │ │bar2│ │ │ │ │ │ │ │ │ │ │---------------│ │ │ │ bar3 │ │ │ │ │ │ ------------------------------- does anybody know about this problem? help me please. thanks.
-- modified at 1:56 Tuesday 26th December, 2006
|
|
|
|

|
sizecbar.cpp - line 536
mdc.FillRect(rcDraw, CBrush::FromHandle(
(HBRUSH) (DWORD_PTR) GetClassLong(m_hWnd, GCL_HBRBACKGROUND)));
|
|
|
|

|
In Sizing control bar, I have added one dialog. On that dialog, I have added one ToolBar. In that dialog's Message Map, I have added Command Handler for the ToolBar buttons. But button doesn't get Command Handler, so it is disabled.
If I add command handler on MainFrame, then it works properly.
Why it happens?
Is anyone can answer?
Thnaks for your co-operation.
|
|
|
|

|
Dear all,
When i use this class, i use CListView in my control bar .
Then i can into mylistview::OnInitialUpdate() in docking window,but is can't int mylistview::OnInitialUpdate() in floating window. If you have any suggest, please let me k now thanks!
chihyuchen
|
|
|
|

|
This is a very Nice control.
I have used this control in many applications.
But I have one application which requires multiple dialogs in Control Bar.
Depending upon some button click, I have to show different dialog in Control Bar & hide the previous one.
Is this possoble & If yes, can you please tell me how?
Thanks for developing this nice control.
& also thanks for your Help in advance.
-Shailesh
|
|
|
|

|
when the bar floating,how to change width and height of the bar through program?
|
|
|
|

|
I have the same question , anyone?
|
|
|
|

|
I have updated the CSizingControlBar so that multiple controls are allowed and can be correctly resized. Does anybody know where I can post this changes or how I can inform the author?
Greetings
|
|
|
|

|
Are your changes small enough to post in a reply to this thread? I am having trouble with CSizingControlBar::OnTrackUpdateSize(). The line that reads "CSizingControlBar* pBar = arrSCBars[nGrowingBar];" can assert (debug) or throw (release) due to nGrowingBar being out of range. This problem sometimes occurs when dragging a resize bar to the bottom of the frame. I just started looking into this and do not have a fix yet. Does your fix address this problem? Roy F.
|
|
|
|

|
At first, my fixes do not address the issue you mentioned, sorry.
Second, my changes are not very large, but too large to post them
in a reply. If it is allowed, I could post a link here for downloading
my changes.
Markus
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
DevStudio-like docking window
| Type | Article |
| Licence | |
| First Posted | 16 Nov 1999 |
| Views | 821,128 |
| Bookmarked | 335 times |
|
|