News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Help organizing & placing windows

Started by NoCforMe, November 22, 2011, 01:52:28 AM

Previous topic - Next topic

NoCforMe

i'm working on an app with a toolbar across the top. I'd like to add a strip above the toolbar where I can put some more controls (a couple combo boxes, maybe some more buttons). I can't quite figure out how to do this.

Shoiuld I
  • create a child window to fill this strip, and put the controls there? or
  • just open up a strip of parent window and put the controls there?
To see if the second method would work, I tried moving the toolbar window down by using MoveWindow(), but no matter what value I passed it for Y, the window remained stuck where it was, at the top of the parent's client area. So it seems this is the way toolbars were designed to work, at least by default. I looked for some styles that might allow me to move it, but didn't find anything.

I don't want a floating toolbar (i.e, one that can be picked up and moved by the user), just to move it down and put some other stuff above it. If this doesn't work, I guess I could put my other controls below the toolbar, but I'd really rather have them above.

I have lots of programs that do just this, so I know it's possible, just don't know how. Hopefully this can be done without subclassing, using plain vanilla Windows stuff.

mineiro

I think you are looking for "rebar" Sr NoCforMe.

NoCforMe

Hmm; I've been seeing that term a lot on MSDN but hadn't bothered trying to find out what it was. Now I know.

Not sure that's what I want. Apparently you can only put one child window (e.g., a combobox control) in each band, so I'd have to create multiple bands. I was hoping for something a little simpler. But I've got rebars bookmarked ...

jj2007

Here is a list of candidates, and TB_SETBOUNDINGSIZE is one of them. You may need subclassing, though.

NoCforMe

Well, after digging around in MSDN a while, I found another way to do this. (Look, Ma, no subclassing!)

ToutEnMasm

Quote
Well, after digging around in MSDN a while, I found another way to do this. (Look, Ma, no subclassing!)
An interesting soluce to create the same thing as a rebar without his many advantages .
With a rebar,you can move and resize the bands with the mouse.This need no line code to work.
Quote
you can only put one child window (e.g., a combobox control) in each band
This need to be verify.

ToutEnMasm


I have verify that a band could have only one child window (only one combo),it's false.
Here is a simple sample.

NoCforMe

Quote from: ToutEnMasm on November 22, 2011, 09:40:08 AM
Quote
Well, after digging around in MSDN a while, I found another way to do this. (Look, Ma, no subclassing!)
An interesting soluce to create the same thing as a rebar without his many advantages .
With a rebar,you can move and resize the bands with the mouse.This need no line code to work.

But I don't want those "advantages". I don't want the band to be resizeable, or moveable, or configurable. I just want a place to park some additional controls.

NoCforMe

So to get back to my original question (remember that?), is there any way I can open up some (parent client area) space above a toolbar and put controls in that space?

Or do toolbars have "magnets" that keep them firmly fixed to the top of their parent windows? (This appears to be the case, as I've tried to use MoveWindow() to move the toolbar down, but it didn't work.) This would still be my first choice in my situation.

mineiro

I have tried it, and movewindow do not have worked like you say. Now I understand.
So, I played with it, thinking that toolbar is fixed on the upper, but if you set some styles, you can put the toolbar to down.
TBSTYLE_ALTDRAG OR TBSTYLE_FLAT OR TBSTYLE_TRANSPARENT OR CCS_BOTTOM OR CCS_NOMOVEY OR CCS_TOP OR WS_CHILD OR WS_OVERLAPPED OR WS_VISIBLE

In microsoft site have one tool to play with messages and styles of controls, I use that tool before code. (Control Spy 2.0). I'm now investigating the messages received to toolbar control to see if I can give you one answer.

jj2007

CCS_NOMOVEY does the trick, see attachment - thanks mineiro :U

mineiro

You can use CCS_NOMOVEY with CCS_NORESIZE, so movewindow will work. :U

NoCforMe

I'm confused. (A not uncommon state of affairs.)

MSDN says about CCS_NOMOVEY: "Causes the control to resize and move itself horizontally, but not vertically, in response to a WM_SIZE message.".

Wouldn't I want to use CCS_NOMOVEX instead, since I want to be able to move the toolbar vertically but not horizontally?

jj, I downloaded your example, but cdt.exe doesn't open a window or even show up on the taskbar. ????? Kinda creepy to have a process running that's a ghost ...

mineiro

Hello Sr NoCforMe, I have downloaded jj2007 example and worked here, and appears in taskbar. Depending of style of window, they do not appear in taskbar, follows one that do not appear.
My mistake (sorry) before when I have said that "CCS_NOMOVEY with CCS_NORESIZE" can be combined, because one cancels other.
I have done one example that do not deal with CCS_NOMOVEY, only CCS_NORESIZE and worked.
I think this happens depending of what messages you are treating.



jj2007

Quote from: NoCforMe on November 23, 2011, 01:26:17 AM
jj, I downloaded your example, but cdt.exe doesn't open a window or even show up on the taskbar. ????? Kinda creepy to have a process running that's a ghost ...

Which OS? You can use Process Manager 8right-click on Windows taskbar) to kill the process.