Createwindow with minimize and close button only?

BlitzMax Forums/BlitzMax GUI Programming/Createwindow with minimize and close button only?

Hi!

Is it possible to create an app window with just these 2 buttons?
Or at least is there a way to disable the maximize button?

Thanks!
Grisu

To have the window size always the same you could also use the min and max ...

Local Window1:TGadget = CreateWindow:TGadget("Window1",279,96,200,200,Null,WINDOW_TITLEBAR|WINDOW_RESIZABLE )
	SetMinWindowSize( Window1:TGadget, 200 , 200 )
	SetMaxWindowSize( Window1:TGadget, 200 , 200 )


I think if your window has both minimize and maximize buttons you can use Style = 2 to invert them (disable). Play around with it.

Function ModifyWindowButtons(Gadget:TGadget, Style:Int = 1) 
  Local hWnd_temp:Int = QueryGadget(Gadget, QUERY_HWND) 
	
  Local xs:Int = GetWindowLong(hWnd_temp, - 16) 
	Select Style
		Case 1
			xs :| $20000   'WS_MINIMIZEBOX - add Minimize button
			xs :| $10000   'WS_MAXIMIZEBOX - add Maximize button
			
		Case 2
			xs :| $20000   'WS_MINIMIZEBOX - add Minimize button
			
		Case 3
			xs :| $10000   'WS_MAXIMIZEBOX - add Maximize button
	End Select
	
	SetWindowLong hWnd_temp, -16, xs
	UpdateWindowMenu Gadget
	
End Function


Thanks for the help guys!

Here's a fully working test code....
SuperStrict
Import maxgui.Drivers

Local Style:Int = WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS | WINDOW_CENTER '| WINDOW_RESIZABLE
Global MainWindow:TGadget
MainWindow:TGadget = CreateWindow("test app", 0, 0, 340, 106, Null, Style)
ModifyWindowButtons(MainWindow,2)

Repeat
	WaitEvent() 
	Select EventID()
		Case EVENT_WINDOWCLOSE Or EVENT_APPTERMINATE
		End
	End Select
Forever
End

Function ModifyWindowButtons(Gadget:TGadget, Style:Int=1) 
  Local hWnd:Int = QueryGadget(Gadget, QUERY_HWND) 
  Local xs:Int = GetWindowLongA(hWnd, - 16) 
	Select Style
		Case 1
			xs :| $20000   'WS_MINIMIZEBOX - add Minimize button
			xs :| $10000   'WS_MAXIMIZEBOX - add Maximize button
			
		Case 2
			xs :| $20000   'WS_MINIMIZEBOX - add Minimize button
			
		Case 3
			xs :| $10000   'WS_MAXIMIZEBOX - add Maximize button
	End Select
	SetWindowLongA hWnd, -16, xs
	UpdateWindowMenu Gadget	
End Function