Here's the deal. I added a tool bar to my prog with CreateToolbarEx. But it doesn't reduce the size of the client area. If I start drawing text, the first line is hidden under the tool bar. To fix this, I added the height of the tool bar to when I do WM_PAINT.

But this isn't a very good solution. The tool bar blinks whenever I issue InvalidateRect. And when I added WS_VSCROLL, the scroll bar includes the area occupied by the toolbar.

So how do I move the client area, and hopefully the scroll bar, down so they start under the tool bar? Or am I going to be forced into creating a child window to occupy the desired client area? Tell me it ain't so!

Posted on 2001-10-10 04:27:13 by S/390
Hi S/390

Change client rect by inserting this into WndProc

.if wParam==TRUE
mov esi,lParam
add (RECT ptr [esi]).top,19

Posted on 2001-10-10 04:48:30 by KetilO

I think this is what you are after, it sizes and positions the toolbar on each resize.

invoke SendMessage,hToolBar,TB_AUTOSIZE,0,0

Posted on 2001-10-10 06:24:03 by hutch--
Hi S/390

A RadASM project to show a way it could be solved.

Posted on 2001-10-10 07:09:26 by KetilO

Thanks for the ideas. The RAD example builds the tool bar in a different way, and builds it as part of a dialog. I think part of my problem is that I'm trying to do this with the "top level" window. I may end up changing the way I build the tool bar, and this gives me a good example.

I tried the WM_NCCALCSIZE as is, and the client area expanded to cover my scroll bar, menu, and part of the title bar, in other words, the whole window! LOL. I played with the numbers, and it does indeed move the client area. But it also moves the darn tool bar with it! And this is strange. When I did "uncover" the other stuff, everything was "transparent". This may be my problem, since I don't use WM_CREATE, but build the window after the call to CreateWindowEx. I may also have to add back those ShowWindow and UpdateWindow calls that I took out. Hummm... But this does hold promise!


Thanks for the tip, but I already send a TB_AUTOSIZE when I do WM_SIZE. The tool bar resizes just fine. The problem is that the tool bar, at least one created this way, is always placed in the client area. I need to create a smaller client area, that doesn't include the tool bar. Or I need to create the tool bar outside of the client area... ... ...


ed typo
Posted on 2001-10-10 12:03:46 by S/390
Hi S/390

After I posted the WM_NCCALCSIZE I came to think of that the toolbar is part of the clientrect, so i did expect the toolbar to move with it.

So I guess my clientrect project is a way to solve it. You dont need to use a dialogbox as in the project.

Posted on 2001-10-10 16:10:14 by KetilO
Sorry to say that to the best of my knowledge it's so... Child window is ugly but the only way I figured get around this a while back in the old board days.
Posted on 2001-10-10 16:53:09 by rafe
Well, I've been putzing around with this, and can't get it to act the way I want. So I bit the bullet and made a child window to fill the client area. Not really that big of a deal, but a pain to register another class, setup another "WndProc" and move half of my code there. And it just seems like a waste of good "space". You'ld think with all the WinAPI has to offer, there would be an easy way to control the client area. Maybe there is, I just can't figure it out.

Oh well, life in Windowland I guess. But it does work just the way I want using the chlid "view" window!

Rock on... :)
Posted on 2001-10-12 10:34:09 by S/390