[MaxGUI] Changing Window Style Flags

BlitzMax Forums/BlitzMax Programming/[MaxGUI] Changing Window Style Flags

CASO(Posted 2006) [#1]
I know how to do it when creating the window but the problem is I need to CHANGE THE FLAGS AFTER THE WINDOW IS ALREADY CREATED!!!

Is it possible?
Please help (no one ever really does)


CASO(Posted 2006) [#2]
I'm using Windows and I should be able to use the Win32 module to do it shouldn't I. One problem, I don't know how.


grable(Posted 2006) [#3]
You should look into GetWindowLongA and SetWindowLongA, with those two functions you can change a windows style and many other things like its wndproc.

THIS IS WINDOWS ONLY

heres a short example:
SuperStrict

Global win:TGadget = CreateWindow( "Window", 0,0, 128,128, Null, WINDOW_RESIZABLE | WINDOW_TITLEBAR)
Global btn:TGadget = CreateButton( "Test", 32,32, 75,25, win)
Global btn2:TGadget = CreateButton( "Exit", 32,64, 75,25, win)

While WaitEvent()
	Select EventID()
		Case EVENT_GADGETACTION
			Select EventSource()
				Case btn
					' change window style
					Local hwnd:Int = QueryGadget( win, QUERY_HWND)
					Local style:Int = GetWindowLongA( hwnd, GWL_STYLE)					
					SetWindowLongA( hwnd, GWL_STYLE, style & ~( WS_CAPTION | WS_BORDER | WS_THICKFRAME))
					' only way i could get it to update itself
					SetGadgetShape( win, GadgetX(win),GadgetY(win), GadgetWidth(win) + 1,GadgetHeight(win) + 1)
					SetGadgetShape( win, GadgetX(win),GadgetY(win), GadgetWidth(win) - 1,GadgetHeight(win) - 1)
				Case btn2
					Exit
			EndSelect
			
		Case EVENT_WINDOWCLOSE		
			Exit
	EndSelect
Wend
End
Note, i could not get the window to update itself after the change, no matter which invalidate/redraw/whatever functions i tried. so i resorted to resizing it instead, which is allmost garuanteed ;)


CASO(Posted 2006) [#4]
Thanks,
The thing I'm really concerned with is turning the following properties on and off:
-titlebar
-statusbar
-menu
-accepts files
-resizeable
-toolwindow

I'm trying to create a GUI form editor for BMax but I couldn't change flags without recreating the window which destroyed everything on the previous window.


SebHoll(Posted 2006) [#5]
Just a thought but if you've kept track of all the gadgets on the windows, with the postition etc. then surely you can loop through the list of objects (if you're storing them in an array or type) and make a new window and redraw all the gadgets again. I don't suppose it would take that long to do it and people won't be constantly changing windows properties.


CASO(Posted 2006) [#6]
I'll try that


kfprimm(Posted 2006) [#7]
nvm...