Graphics window within MaxGUI

BlitzMax Forums/BlitzMax Programming/Graphics window within MaxGUI

wildboar(Posted 2005) [#1]
Is there a way to run a graphics window within a window created by MaxGUI... OR... to use the MaxGui gadgets (button/textfield/etc) within a graphics window? I didn't see anything like this in the docs.


REDi(Posted 2005) [#2]
You need to CreateCanvas() then call CanvasGraphics() to get a TGraphics object to that canvas, then you can SetGraphics().

Hope that helps


Amon(Posted 2005) [#3]

SuperStrict

Local MainWindow:TGadget
Local MainCanvas:TGadget

MainWindow = CreateWindow("MyWindow",100,100,800,600,0,WINDOW_TITLEBAR|WINDOW_MENU|WINDOW_STATUS)
MainCanvas = CreateCanvas(0,0,800,600,MainWindow)


While WaitEvent()

		Select EventID()				
			Case EVENT_WINDOWCLOSE
				FreeGadget MainCanvas
				End
		End Select

Wend



wildboar(Posted 2005) [#4]
Thanks... I'll try this when I get home from work.


Perturbatio(Posted 2005) [#5]
SuperStrict

Local MainWindow:TGadget = CreateWindow("MyWindow",100,100,800,600,Null,WINDOW_TITLEBAR|WINDOW_MENU|WINDOW_STATUS)
Local MainCanvas:TGadget = CreateCanvas(0,0,800,600,MainWindow)


SetGraphics(CanvasGraphics(MainCanvas))

While WaitEvent()
	
		Select EventID()				
			Case EVENT_WINDOWCLOSE
				FreeGadget MainCanvas
				End
		End Select
		
		Cls
		DrawRect(50, 50, 50, 50)
		Flip

Wend