I'm a newbie to win32asm programming, and would like to know how much is involved in constructing a Controlbar as is seen in applications like Visual C++ and BC++ Builder.

What are the strategies for making such a construction in win32asm or C.

Posted on 2001-08-18 07:03:36 by rolft
Do you mean a 'docking' toolbar? One you can stick into the main window on some edge, or pull it and let it free float as a topmost window?
Posted on 2001-08-18 23:48:23 by Ernie
Yes, I mean a full blown docking toolbar, which when docked into the main window, has an appearance like the toolbars in the mentioned applications - each toolbar-area is raised instead of the standard rebar style.

Posted on 2001-08-19 03:42:02 by rolft
The basic idea to make a docking toolbar is simple. The devil is in the details.

To dock a window, just change it's WS_CHILD and S_EX_TOOLWINDOW styles to TRUE and FALSE, respectively. And of course, set them the other way to undock.

Of course, it would be nice to be able to plant these on Rebar controls to borrow that functionality. 4 rebars, in fact, so each side of the screen is covered.

I spent about 3 solid full time months on this and only got close. The biggest hurdle left was handling simple toolbars, as these make asumptions about their parent which simply are not ture when docking.

A sample program using this control is available. I have no plans to release the source code (about 150K total spread over 12 .asm and .inc files), but am quite willing to discuss how I did certain details.
Posted on 2001-08-19 09:06:28 by Ernie
You are scaring me. I would be making those in about a month from now.:grin:
Posted on 2001-08-19 13:28:24 by MovingFulcrum
Hey, I wish you good luck. And yes, I am trying to scare you.

It's not a simple problem. If I hadn't been coding near full time for the previous year in MASM32 for windows I wouldn't have got as far as I did.

And I did get pretty far, my control class works quite nicely for well behaved controls like edit boxes or list views, ie, those windows that just sit where they are told to on their parent window.

The last trick left over (OK, the largest on the TODO list) was toolbars. Toolbars just jump around too much, and I don't see all the implications of the jumping to make a "well behaved" container window class for them so the rest of my code can work them.

To a lesser degree, another leftover TODO was the 'docking logic,' or how to tell over which edge of the main app window you are over, and what windows are already there so you can drop a floating window where you wish, not 'just somewhere' in an existing rebar.

And I do mean 'existing.' I found rebars so quirky (even after subclassing them) that I found it best to simply destroy any rebar that holds zero children. That means before you drop on a rebar, you need check it really exists, and create it there if it doesn't.

Should I mention things like painting the control buttons on a docked tab?

Hey, even making a decent window shadow box to show drag movement took a couple weeks of fine tweaking (and also a very nice mag article on something similar).
Posted on 2001-08-19 22:47:57 by Ernie