Status bar

Just starting out? Need help? Post your questions and find answers here.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Status bar

Post by Polo »

I'm wondering on what's the expected behaviour on this, is the status bar supposed to take some space into the window's inne height (like it does on the Mac) or is it supposed to do like the toolbar and be an additional height?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Status bar

Post by srod »

The statusbar is like any other child window and sits in the client area of the window. You will thus have to subtract the height of the statusbar from the height of the window's client area when calculating how much of the window you can use.

What I am saying is that, unlike menus and scrollbars, GetClientRect_() will ignore statusbars and toolbars etc. and will not adjust the height value returned because there is a statusbar present.
I may look like a mule, but I'm not a complete ass.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Status bar

Post by Polo »

Thanks srod. I was wondering as this doesn't happen with the toolbars, and it's not clearly stated in the help that the status bar will take space in the window's client area :)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Status bar

Post by srod »

No, it is the same with toolbars which also encroach into the clientarea.

If you add a scrollbar to a window (not a separate scrollbar control) then Windows adjusts the size of the client area. Thus you can consider a window's scrollbars as being separate from the window's client area.

This is not true for toolbars and statusbars which actually sit inside the clientarea (Windows makes no adjustment).
I may look like a mule, but I'm not a complete ass.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Status bar

Post by Polo »

Are you sure?

On the Mac the toolbar is not taking the client area height. Not on Carbon, havent tested on Cocoa.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Status bar

Post by Polo »

Ok I tested on Windows and on Cocoa, it seems the Toolbar is taking the client area height only on Windows... weird.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Status bar

Post by srod »

Absolutely sure. :)

Code: Select all

If OpenWindow(0, 100, 150, 300, 100, "PureBasic - StatusBar Example", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
  GetClientRect_(WindowID(0), rc.RECT)
  Debug "Client height before toolbar = " + Str(rc\bottom)

  If CreateToolBar(0, WindowID(0))
    ToolBarStandardButton(0, #PB_ToolBarIcon_New)
    GetClientRect_(WindowID(0), rc.RECT)
    Debug "Client height after toolbar = " + Str(rc\bottom)
  EndIf

  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
  
EndIf
I may look like a mule, but I'm not a complete ass.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Status bar

Post by Polo »

Yes, but not on Mac ;)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Status bar

Post by srod »

How did you get the client height on the mac?
I may look like a mule, but I'm not a complete ass.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Status bar

Post by Polo »

srod wrote:How did you get the client height on the mac?
I didn't. Just create a window with a height of 25, add a toolbar, and you'll easily see the available height is still 25, whereas it's not on Windows :)
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Status bar

Post by srod »

Ah, you mean the window resizes in order to keep the client area it's original size?

Windows does not do that at all; although there are functions for modifying the window size in relation to various window styles.
I may look like a mule, but I'm not a complete ass.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Status bar

Post by Polo »

srod wrote:Ah, you mean the window resizes in order to keep the client area it's original size?

Windows does not do that at all; although there are functions for modifying the window size in relation to various window styles.
Err, no idea how it work, but the Toolbar never eats the client area on PB Mac. Can get messy with cross platform apps!
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Status bar

Post by srod »

Yep - messy and ugly! :)
I may look like a mule, but I'm not a complete ass.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Status bar

Post by Polo »

srod wrote:Yep - messy and ugly! :)
Sounds like it could do with a feature request! ;)
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Status bar

Post by Shardik »

Polo wrote:
srod wrote:How did you get the client height on the mac?
I didn't. Just create a window with a height of 25, add a toolbar, and you'll easily see the available height is still 25, whereas it's not on Windows :)
Sorry, but the behaviour of Mac's PB 4.61 with the Carbon framework (Snow Leopard) doesn't differ from that of Windows' PB 4.61 (Windows 7 Home Premium x64, PB x86 and x64): both don't change the window's height when adding a StatusBar. Please try the following code example on Mac and Windows:

Code: Select all

OpenWindow(0, 270, 100, 200, 60, "StatusBar test")
ButtonGadget(0, 45, 10, 110, 20, "Add StatusBar")

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow
      Break
    Case #PB_Event_Gadget
      If EventGadget() = 0
        If EventType() = #PB_EventType_LeftClick
          If CreateStatusBar(0, WindowID(0))
            AddStatusBarField(#PB_Ignore)
            StatusBarText(0, 0, "StatusBar")
            DisableGadget(0, #True)
          EndIf
        EndIf
      EndIf
  EndSelect
ForEver
Post Reply