weil ich mich geärgert hab, dass purebasic über keine client-size befehle verfügt, habe ich auf die schnelle ein paar nützliche und stark vereinfachte prozeduren geschrieben. vielleicht kann es ja mal jemand gebrauchen.

Code: Alles auswählen
Procedure WindowClientX(Window)
WindowClientRect.RECT
GetWindowRect_(WindowID(Window), @WindowClientRect)
WindowClientPoint.POINT
ClientToScreen_(WindowID(Window), @WindowClientPoint)
ProcedureReturn WindowX(Window) + (WindowClientPoint\x - WindowClientRect\left)
EndProcedure
Procedure WindowClientY(Window)
WindowClientRect.RECT
GetWindowRect_(WindowID(Window), @WindowClientRect)
WindowClientPoint.POINT
ClientToScreen_(WindowID(Window), @WindowClientPoint)
ProcedureReturn WindowY(Window) + (WindowClientPoint\y - WindowClientRect\top)
EndProcedure
Procedure WindowBorder(Window)
ProcedureReturn WindowClientX(Window) - WindowX(Window)
EndProcedure
Procedure WindowTitleBar(Window)
ProcedureReturn WindowClientY(Window) - WindowY(Window) - WindowBorder(Window)
EndProcedure
Procedure WindowRealWidth(Window)
ProcedureReturn WindowWidth(Window) + (WindowBorder(Window) * 2)
EndProcedure
Procedure WindowRealHeight(Window)
ProcedureReturn WindowTitleBar(Window) + WindowHeight(Window) + (WindowBorder(Window) * 2)
EndProcedure
Code: Alles auswählen
IncludeFile "ClientSize.pbi"
If OpenWindow(0, 0, 0, 320, 240, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered, "Window- & ClientSize Demo")
If CreateGadgetList(WindowID(0))
TextGadget(0, 5, 5, 145, 15, "")
TextGadget(1, 5, 20, 145, 15, "")
TextGadget(2, 5, 50, 145, 15, "")
TextGadget(3, 5, 65, 145, 15, "")
TextGadget(4, 5, 95, 145, 15, "")
TextGadget(5, 5, 110, 145, 15, "")
TextGadget(6, 5, 140, 145, 15, "")
TextGadget(7, 5, 155, 145, 15, "")
TextGadget(8, 5, 185, 145, 15, "")
TextGadget(9, 5, 200, 145, 15, "")
Repeat
Event = WaitWindowEvent()
SetGadgetText(0, "WindowX = "+Str(WindowX(0)))
SetGadgetText(1, "WindowY = "+Str(WindowY(0)))
SetGadgetText(2, "WindowWidth = "+Str(WindowWidth(0)))
SetGadgetText(3, "WindowHeight = "+Str(WindowHeight(0)))
SetGadgetText(4, "WindowRealWidth = "+Str(WindowRealWidth(0)))
SetGadgetText(5, "WindowRealHeight = "+Str(WindowRealHeight(0)))
SetGadgetText(6, "WindowClientX = "+Str(WindowClientX(0)))
SetGadgetText(7, "WindowClientY = "+Str(WindowClientY(0)))
SetGadgetText(8, "WindowBorder = "+Str(WindowBorder(0)))
SetGadgetText(9, "WindowTitleBar = "+Str(WindowTitleBar(0)))
Until Event = #PB_Event_CloseWindow
EndIf
EndIf
End
c ya,
nco2k