Page 1 of 1

How can I get the height of a statusbar?

Posted: Thu Oct 13, 2005 8:51 pm
by Trond
How can I get the height of a statusbar? (I can't get my editorgadget to resize properly.)

Posted: Thu Oct 13, 2005 9:20 pm
by utopiomania
I use this..

Code: Select all

    ;Statusbar
    hStatus = CreateStatusBar(#IdStatus, WindowID())
    If hStatus
      ;Get the statusbar height
      SendMessage_(hStatus, #SB_GETRECT, 0, @Value.RECT)
      SbHeight = Value\bottom - Value\top + 1

Posted: Thu Oct 13, 2005 11:29 pm
by blueznl
or

Code: Select all

GetWindowRect_(statusbar_h,@rect)
ProcedureReturn (rect\bottom-rect\top)

Posted: Fri Oct 14, 2005 11:03 am
by utopiomania
@blueznl, I'm not shure, but

Code: Select all

rect\bottom - rect\top
will be one pixel too small, or am I wrong ?

Posted: Fri Oct 14, 2005 1:30 pm
by blueznl
good one, could be :-)

i'm not on a machine where i can check it, unfortunately

Posted: Fri Oct 14, 2005 4:35 pm
by Trond
Thanks, I've got it working. It does not seem like it returns one too little pixels.

Posted: Fri Oct 14, 2005 5:32 pm
by utopiomania
Seems these two methods are not returning the same rectangle coordinates.

SB_GETRECT with SendMessage() retrieves the bounding rectangle of a part in a status window.

GetWindowRect_() retrieves the dimensions of the bounding rectangle of the specified window.

All according to Microsoft, but using GetRect_() and rect\bottom-rect\top returns one pixel
too many (23,20 pixels), contrary to what I expected.

Using SB_GETRECT and Value\bottom - Value\top + 1 returns the correct height (22,19) judged
from a few screendumps both with and without XP skins enabled.