|
|
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!
|
|
|
|

|
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
|
|
|
|

|
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
|
|
|
|

|
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
|
|
|
|

|
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
|
|
|
|

|
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 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
|
|
|
|

|
I don't speak english.
it is operating in SDI(single Document interface)....
is this operating in MDI?
mail: kyfire4420@hotmail.com
|
|
|
|

|
I see that SendMessageToDescendants() of CFrameWnd is not sending the WM_INITIALUPDATE to the floating dlg. Why this happens?
|
|
|
|

|
An example created with files scbarg.cpp. sizecbar.cpp, scbarg.h, sizecbar.h works fine with vx 2005 and windows 2K but it doesn't work with VS 2005 and windows XP.
Any Suggestions...
|
|
|
|

|
I use your sample,but when i move the bar and close the program,next time i open the program ,the bar's
position is different .
pleas fix this bug,i want know how to fix it.
wangpeng.
2006-03-20
|
|
|
|

|
Really a great work.
I have a question.
How we can integrate a scrollbar in the same CSizingControlBar.
Because I am used four CStatic control inside controlbar and it goes out of the controlbar's size.
Please give an answer.
Thanks and Regards
Alvin
This is Alvin
-- modified at 11:02 Thursday 9th March, 2006
|
|
|
|

|
I like to use the CSizingControlBar in Visual Studio 2005.
I could compile and execute the advanced example in reference to the article of FAQ, "problem compiling in VS 2005 ". But I couldn't resize or float the control bar in this example. This phenomenon was same in the two demo programs, which were downloaded with source code.
In the case of compiling and executing with VC++ 6.0, I could operate the control bars without problems in all programs.
I have no idea why I couldn't operate (move, resize, dock and float) the control bar in VS 2005. I am a beginner using CSizingControlBar. So, any information you can provide me will be of great help.
Thank you in advance.
|
|
|
|

|
I like to use the bar as page navigator,
fixed on the top of main window.
( No floating is necessary )
So I like to remove any border at all, when the bar is docked to window.
I tried window style, WM_BORDER, WM_THICKFRAME off.
but none of them working.
even these style off, the CWnd::Create function creates
windows with border.
Thanks in advance.
|
|
|
|

|
I am a beginner want to use this great code in my project. can somebody give me an example to place a dialog (and /or with custom control) to this docking toolbar? my email is herrywelly@hotmail.com
cheers;)
|
|
|
|

|
Hi every one, I'm trying to use CSizingControlBar in a DLL-file, but I cant resize the bar, the cursor change when I move across the "splittbar", but I cant get it to move. Any one that have tried this? Hope some one know how to solve this.
|
|
|
|
|

|
I've just upgraded to Visual Studio 2005 and am working through the problems with porting my VC++ application from VC++ 6.0. I have been using the CSizingControlBar with my old application and am very pleased with it. In compiling in VS 2005 I get the following error message from the compiler. I can't seem to fix the problem on my own. Doesn't anybody have any ideas?
f:\jcs\gwviz\scbarg.cpp(57) : error C2440: 'static_cast' : cannot convert from 'UINT (__thiscall CSizingControlBarG::* )(CPoint)' to 'LRESULT (__thiscall CWnd::* )(CPoint)'
Cast from base to derived requires dynamic_cast or static_cast
where the code around line 57 is:
54 BEGIN_MESSAGE_MAP(CSizingControlBarG, baseCSizingControlBarG)
55 //{{AFX_MSG_MAP(CSizingControlBarG)
56 ON_WM_NCLBUTTONUP()
57 ON_WM_NCHITTEST()
58 //}}AFX_MSG_MAP
59 ON_MESSAGE(WM_SETTEXT, OnSetText)
60 END_MESSAGE_MAP()
b jacobs
-- modified at 15:23 Tuesday 20th December, 2005
|
|
|
|

|
How can I add toolbar into that control?!
For example, at this control bar I placed grid and above the grid toolbar.
|
|
|
|

|
Thx for the class dude! Very useful over here!
After playing a bit with the CControlBar, I found that to know when a CControlBar is docked, I have to trap the ON_WM_WINDOWPOSCHANGED message in my control bar, since it seems to be the only message which is sent to my controlbar when it is docked. This message is triggered but a SetWindowPos call and is sent multiple times when the window is docked. Isn't there a better, simple and clean way to do that?
I am very mad that the guy at Microsoft who coded the CFrameWnd class, or at least who added the docking support wasn't able to put the docking related method virtual. My problem would already be solved if the guy would have think a bit.
|
|
|
|

|
I have some floating bars in my application.
How can I fix the position and size of one of floating bar?
I know the set of the control bar always floating as followed:
m_wndMyBar.EnableDocking(0); // no docking
FloatControlBar(&m_wndMyBar, point);
Thanks
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
DevStudio-like docking window
| Type | Article |
| Licence | |
| First Posted | 16 Nov 1999 |
| Views | 821,197 |
| Bookmarked | 335 times |
|
|