No announcement yet.

StatusBar Size

  • Filter
  • Time
  • Show
Clear All
new posts

  • StatusBar Size

    It MUST be in the docs SOMEWHERE and I missed it, but if adding a statusbar to a dialog (SDK or DDT) what in the world resizes the bar to the bottom, and about 20 pixels high? (Even if I tell it I want 100 pixels high and only 100 pixels shows the length of the dialog, and about 20 pixels high).

    Am I forgetting some message sent? some attribute? or something repainting? and I have not caught it??????

    (Programming 101, but something I never had to change the state of a statusbar before, so I am at a loss)
    Engineer's Motto: If it aint broke take it apart and fix it

    "If at 1st you don't succeed... call it version 1.0"

    "Half of Programming is coding"....."The other 90% is DEBUGGING"

    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

  • #2
    I would think that there would be a difference between using DDT or an SDK (CreateWindow) GUI's.

    Normally using the API, when the patent window is resized (WM_SIZE) the WM_SIZE message is forwarded to the StatusBar control. This resizes it to the width of the parent window and the height is set by a default size for the control based on its current font size. The DDT engine appears to do this automatically for you.

    You can also set the height of the control by sending the SB_SETMINHEIGHT message to the StatusBar control.

    Some controls overide the values used in CreateWindowEx for the width, height or position. There are common controls styles which force a control to stick to the top, side or bottom of the parent window and they likely have a default as well (statusbars are by default on the bottom).

    When a control is created (CreateWindowEx or DDT command) do not assume the coordinates (position) and the width and height will be what you defined. The control can override this based on styles and defaults.

    The PB docs say the default style used for the StatusBar is CCS_BOTTOM (one of those common control styles I mentioned).
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"


    • #3
      A static (label) control with a raised edge (WS_EX_STATICEDGE) with the background overriden to GetStockObject(WHITE_BRUSH) in the WM_CTLCOLORSTATIC processing looks a lot like a a status bar.

      Of course, if your dialog is resizeable, you'll have to relocate and resize it yourself on WM_SIZE.

      (I never tried that SB_SETMINHEIGHT thing. That looks like a much more straightforward way to create a status bar with a non-standard size).

      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]