It works fine on Windows...
Code: Select all
Procedure pi_DisableWindowMaximize(WindowNo.i, Disable.i = #True) ; Platform independent DisableWindowMaximize
Protected WindowID.i
If IsWindow(WindowNo)
WindowID = WindowID(WindowNo)
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
If Disable
SetWindowLong_(WindowID, #GWL_STYLE, GetWindowLong_(WindowID, #GWL_STYLE) & (#WS_MAXIMIZEBOX ! - 1))
Else
SetWindowLong_(WindowID, #GWL_STYLE, GetWindowLong_(WindowID, #GWL_STYLE) | #WS_MAXIMIZEBOX)
EndIf
SetWindowPos_(WindowID, 0, 0, 0, 0, 0, #SWP_NOZORDER | #SWP_NOMOVE | #SWP_NOSIZE | #SWP_FRAMECHANGED)
CompilerCase #PB_OS_Linux
; ToDo - - please help.
MessageRequester("pi_DisableWindowMaximize","Just works on Windows"+Chr(10)+"Don't know how to code this part. :-((")
CompilerDefault
MessageRequester("pi_DisableWindowMaximize","Function not available on this system.")
CompilerEndSelect
EndIf
EndProcedure
Procedure pi_DisableWindowMinimize(WindowNo.i, Disable.i = #True) ; Platform independent DisableWindowMinimize
Protected WindowID.i
If IsWindow(WindowNo)
WindowID = WindowID(WindowNo)
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
If Disable
SetWindowLong_(WindowID, #GWL_STYLE, GetWindowLong_(WindowID, #GWL_STYLE) & (#WS_MINIMIZEBOX ! - 1))
Else
SetWindowLong_(WindowID, #GWL_STYLE, GetWindowLong_(WindowID, #GWL_STYLE) | #WS_MINIMIZEBOX)
EndIf
SetWindowPos_(WindowID, 0, 0, 0, 0, 0, #SWP_NOZORDER | #SWP_NOMOVE | #SWP_NOSIZE | #SWP_FRAMECHANGED)
CompilerCase #PB_OS_Linux
; ToDo - - please help.
MessageRequester("pi_DisableWindowMaximize","Just works on Windows"+Chr(10)+"Don't know how to code this part. :-((")
CompilerDefault
MessageRequester("pi_DisableWindowMinimize","Function not available on this system.")
CompilerEndSelect
EndIf
EndProcedure
Procedure pi_DisableWindowResize(WindowNo.i, Disable.i = #True) ; Platform independent DisableWindowResize
Protected WindowID.i
If IsWindow(WindowNo)
WindowID = WindowID(WindowNo)
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
If Disable
SetWindowLong_(WindowID, #GWL_STYLE, GetWindowLong_(WindowID, #GWL_STYLE) & (#WS_SIZEBOX ! - 1))
Else
SetWindowLong_(WindowID, #GWL_STYLE, GetWindowLong_(WindowID, #GWL_STYLE) | #WS_SIZEBOX)
EndIf
SetWindowPos_(WindowID, 0, 0, 0, 0, 0, #SWP_NOZORDER | #SWP_NOMOVE | #SWP_NOSIZE | #SWP_FRAMECHANGED)
CompilerCase #PB_OS_Linux
; ToDo - - please help.
MessageRequester("pi_DisableWindowResize","Just works on Windows"+Chr(10)+"Don't know how to code this part. :-((")
CompilerDefault
MessageRequester("pi_DisableWindowResize","Function not available on this system.")
CompilerEndSelect
EndIf
EndProcedure
If OpenWindow(0, 0, 0, 200, 200, "Window not resizeable", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
WindowBounds(0, 200, 200, #PB_Ignore, #PB_Ignore)
ButtonGadget(0, 10, 10, 180, 60, "MinimizeButton")
ButtonGadget(1, 10, 70, 180, 60, "MaximizeButton")
ButtonGadget(2, 10, 130, 180, 60, "Sizer")
MyToggle0.i = #False
MyToggle1.i = #False
MyToggle2.i = #False
Repeat
MyEvent.i = WaitWindowEvent()
If MyEvent = #PB_Event_Gadget
Select EventGadget()
Case 0
pi_DisableWindowMinimize(0, MyToggle0)
MyToggle0 ! 1
Case 1
pi_DisableWindowMaximize(0, MyToggle1)
MyToggle1 ! 1
Case 2
pi_DisableWindowResize(0, MyToggle2)
MyToggle2 ! 1
If MyToggle2
SetWindowTitle(0, "Window resizeable")
Else
SetWindowTitle(0, "Window not resizeable")
ResizeWindow(0, #PB_Ignore, #PB_Ignore, 200, 200)
EndIf
EndSelect
EndIf
Until MyEvent = #PB_Event_CloseWindow
EndIf
