Hi all,
Is it possible to change the window's flags? Actually I want to inhibit/disable #PB_Window_SizeGadget and #PB_Window_MaximizeGadget.
Thanks in advance.
Changing window flags
Re: Changing window flags
Windows only

Code: Select all
Procedure Main()
If OpenWindow(0, 40, 40, 400, 300, "Example", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget)
Protected style, new_style
style = GetWindowLong_(WindowID(0), #GWL_STYLE)
;new_style = style & ~#WS_SIZEBOX
;new_style = style & ~#WS_MAXIMIZEBOX
new_style = style & ~#WS_SIZEBOX & ~#WS_MAXIMIZEBOX
SetWindowLong_(WindowID(0), #GWL_STYLE, new_style)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
EndProcedure : Main()

My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Changing window flags
Try these as you need
Windows only.
EDIT: doh!

Code: Select all
hWnd = WindowID(0)
;ON:
;SetWindowLongPtr_(hWnd, #GWL_STYLE, GetWindowLongPtr_(hWnd, #GWL_STYLE) | #WS_MINIMIZEBOX)
;SetWindowLongPtr_(hWnd, #GWL_STYLE, GetWindowLongPtr_(hWnd, #GWL_STYLE) | #WS_MAXIMIZEBOX)
;OFF:
;SetWindowLongPtr_(hWnd, #GWL_STYLE, GetWindowLongPtr_(hWnd, #GWL_STYLE) & (#WS_MINIMIZEBOX ! - 1))
;SetWindowLongPtr_(hWnd, #GWL_STYLE, GetWindowLongPtr_(hWnd, #GWL_STYLE) & (#WS_MAXIMIZEBOX ! - 1))
;SWITCH:
;SetWindowLongPtr_(hWnd, #GWL_STYLE, GetWindowLongPtr_(hWnd, #GWL_STYLE) ! #WS_MINIMIZEBOX)
;SetWindowLongPtr_(hWnd, #GWL_STYLE, GetWindowLongPtr_(hWnd, #GWL_STYLE) ! #WS_MAXIMIZEBOX)
;REDRAW:
;SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_NOZORDER | #SWP_NOMOVE | #SWP_NOSIZE | #SWP_FRAMECHANGED)
SetWindowLongPtr_(hWnd, #GWL_STYLE, GetWindowLongPtr_(hWnd, #GWL_STYLE) ! #WS_MAXIMIZEBOX)
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: Changing window flags
I have to many time

Code: Select all
Procedure DisableSizeWindow(Window, Status)
Protected style
style = GetWindowLongPtr_(WindowID(Window), #GWL_STYLE)
If Status
style = style & ~#WS_SIZEBOX & ~#WS_MAXIMIZEBOX & ~#WS_MINIMIZEBOX
Else
style = style | #WS_SIZEBOX | #WS_MAXIMIZEBOX | #WS_MINIMIZEBOX
EndIf
SetWindowLongPtr_(WindowID(Window), #GWL_STYLE, style)
EndProcedure
Procedure Main()
If OpenWindow(0, 40, 40, 400, 300, "Example", #PB_Window_SystemMenu)
Protected event
ButtonGadget(0, 10, 10, 60, 30, "ON")
ButtonGadget(1, 80, 10, 60, 30, "OFF")
Repeat
event = WaitWindowEvent()
Select event
Case #PB_Event_Gadget
Select EventGadget()
Case 0
DisableSizeWindow(0, #False)
Case 1
DisableSizeWindow(0, #True)
EndSelect
EndSelect
Until event = #PB_Event_CloseWindow
EndIf
EndProcedure : Main()
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Changing window flags
Thank you so much.
I will use WindowBounds(W, WindowWidth(W), WindowHeight(W), WindowWidth(W), WindowHeight(W)) in Mac. I don't have a Mac next to me. But do you think it might work?
I will use WindowBounds(W, WindowWidth(W), WindowHeight(W), WindowWidth(W), WindowHeight(W)) in Mac. I don't have a Mac next to me. But do you think it might work?