How to create a tool window
Posted: Fri Aug 29, 2008 7:55 am
If anyone has ever wondered how to create a tool window (small title bar) here is an example.
#PB_Window_SizeGadget doesn't appear to work with the tool window style. If you want the window to be resizable use this instead:
Code: Select all
WndID=OpenWindow(#PB_Any,0,0,320,240,"Tool Window")
; Set the extended window style to tool window
SetWindowLong_(WindowID(WndID),#GWL_EXSTYLE,OldStyle|#WS_EX_TOOLWINDOW)
OldStyle=GetWindowLong_(WindowID(WndID),#GWL_EXSTYLE)
; Update the window frame
SetWindowPos_(WindowID(WndID),0,0,0,0,0,#SWP_NOSIZE|#SWP_NOREPOSITION|#SWP_NOMOVE|#SWP_FRAMECHANGED)
Repeat: Delay(1)
WaitWindowEvent()
ForEver
Code: Select all
WndID=OpenWindow(#PB_Any,0,0,320,240,"Tool Window")
; Set the extended window style to tool window
SetWindowLong_(WindowID(WndID),#GWL_EXSTYLE,OldStyle|#WS_EX_TOOLWINDOW)
OldStyle=GetWindowLong_(WindowID(WndID),#GWL_EXSTYLE)
; Update the window frame
SetWindowPos_(WindowID(WndID),0,0,0,0,0,#SWP_NOSIZE|#SWP_NOREPOSITION|#SWP_NOMOVE|#SWP_FRAMECHANGED)
; Set the window style to thick frame to be resizable
OldStyle=GetWindowLong_(WindowID(WndID),#GWL_STYLE)
SetWindowLong_(WindowID(WndID),#GWL_STYLE,OldStyle|#WS_THICKFRAME)
Repeat: Delay(1)
WaitWindowEvent()
ForEver