Get the border size of a window

BlitzPlus Forums/BlitzPlus Programming/Get the border size of a window

JoshK(Posted 2005) [#1]
window=CreateWindow("",0,0,400,300)

Notify WindowBorder(window,1)+", "+WindowBorder(window,2)+", "+WindowBorder(window,3)+", "+WindowBorder(window,4)

;1 - left
;2 - right
;3 - top
;4 - bottom
Function WindowBorder(window,edge)
temp=CreateBank(8)
Select edge
Case 1
PokeInt temp,0,GadgetX(window)
PokeInt temp,4,0
ScreenToClient(QueryObject(window,1),temp)
result=-PeekInt(temp,0)
Case 2
PokeInt temp,0,GadgetX(window)+GadgetWidth(window)
PokeInt temp,4,0
ScreenToClient(QueryObject(window,1),temp)
result=PeekInt(temp,0)-ClientWidth(window)
Case 3
PokeInt temp,0,0
PokeInt temp,4,GadgetY(window)
ScreenToClient(QueryObject(window,1),temp)
result=-PeekInt(temp,4)
Case 4
PokeInt temp,0,0
PokeInt temp,4,GadgetY(window)+GadgetHeight(window)
ScreenToClient(QueryObject(window,1),temp)
result=PeekInt(temp,4)-ClientHeight(window)
End Select
FreeBank temp
Return result
End Function


Andres(Posted 2005) [#2]
(GadgetWidth(window) - ClientWidth(window)) / 2
(GadgetHeight(window) - ClientHeighth(window)) / 2

Aren't these basically the same?


sswift(Posted 2005) [#3]
Andres:
The clientwidth is the area inside the window where stuff can be drawn. That does not include the menu bar, title bar, or the status bar. I don't know if Halo's function includes those when calculating the width or not though, so I don't know if your two funcitons are equivalent.