The InfoBar docking issue...

Posted by Shadowfyr on Fri 17 Jan 2003 01:04 AM — 4 posts, 11,355 views.

USA #0
In the process of working on a program of my own I took a look at StatusBar and ToolBar behaviour. The glitch in mushclient's InfoBar appears to be by design. If you Click to move one of these controls from top to bottom they work fine, but if you change the docking position straight from bottom to left or the like it does the same exact thing as the dialog bar mushclient employs. now the reason for this is fairly obvious. The docking code is shared by all these types, but is based off of the toolbar behaviour and tool bards can be like this:

______________    ____          ______
|[] [] []  ... or |[]| or even  |[][]|
--------------    |[]|          |[]  |
                  |[]|          |... |
                  |..|


Depending on what you want to do. I.e. The bar does not know explixitly how you want to arrange the contents and thus how wide or high the bar should be. When you dock it in the middle it tries to auto-match in both directions and sets the width and height to the current window size. As I said, they will also do this if you switch a toolbar from bottom to left or the like without specifically giving it the correct size after it is docked. This should be easy to fix. Simply reset the height to what it starts at when the bar is docked. ;)
Amended on Fri 17 Jan 2003 01:06 AM by Shadowfyr
Australia Forum Administrator #1
Hmmm - wonder where the code for that is, in MFC?
USA #2
Not sure. I was looking at it in VB. With VB a lot of the basic processes are handled by the runtime library. In any case it seems to be something shared in common between Dialog bar, Toolbar, Statusbar and probably the Coolbar control as well. All of them though have a height property, so the obvious fix (at least in VB) is to use the same event that allows it to dock to reset that property. In C++ it could be a bit more complicated. However you are right, something in MFC may be responsible for the strange behaviour.
USA #3
Hmm.

Try maybe: SetWindowPos(DialogbarHandle,0,0,0,0,cy,SWP_NOZORDER|SWP_NOMOVE);

Giving it the 'correct' height in cy and the handle for your bar in DialogbarHandle 'should' fix the height. This is a guess mind you, based on a post at a help site about positioning a toolbar any place within a window. I think it would work though.

There doesn't seem to be 'any' case of this behaviour reported at any of the help sites for this sort of thing. Either no one else uses CDialogBar or none of them use it where it can be undocked. lol