Gadgets in standard BlitzMax programs?

BlitzMax Forums/MaxGUI Module/Gadgets in standard BlitzMax programs?

MoriartyL(Posted 2011) [#1]
My question is whether it's possible to use MaxGUI gadgets in a window that was created by the Graphics statement.


GfK(Posted 2011) [#2]
No, and even if you could, it'd be an ugly way of doing it.


jsp(Posted 2011) [#3]
But it works the other way around, you can use a graphic context (canvas) in a MaxGui window.


Midimaster(Posted 2011) [#4]
Import MaxGUI.Drivers 
Global Window:TGadget , Canvas:TGadget

CreateMyWindow()

CreateTimer 60
While WaitEvent()
	Local tmpGadget:TGadget
	Global MausX%, MausY%
	Select EventID()
		Case EVENT_TIMERTICK
				MyMainLoop
	  			RedrawGadget canvas	
			
	  	Case EVENT_GADGETPAINT
		   		Local Fenster:TGraphics=CanvasGraphics(canvas)
		   		SetGraphics Fenster
				SetClsColor 255,255,255
				SetColor 255,0,0
				'Cls
				DrawOval MausX,MausY,5,5
				Flip 0
	   	Case EVENT_WINDOWCLOSE
			ProgrammEnde 
			
	  	Case EVENT_APPTERMINATE
			ProgrammEnde 
			
		Case EVENT_MENUACTION
		
	 	Case	EVENT_MOUSEDOWN 
				tmpGadget = TGadget(EventSource())			
				If tmpGadget=Canvas
					Print "maus " + mausx + " " + mausy
				EndIf
	 	Case	EVENT_MOUSEMOVE 
				tmpGadget= TGadget(EventSource())
				If tmpGadget=Canvas
					MausX=EventX()
					MausY=EventY()
				EndIf
		Case EVENT_GADGETACTION
	End Select
Wend
ProgrammEnde 


Function ProgrammEnde()
	End
End Function

Function MyMainLoop()
   ' do whatever you want
End Function


Function CreateMyWindow()
		Local flags%=WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS|WINDOW_CENTER
		Window= CreateWindow("Window with Canvas" , 0 , 0 , 600 , 400 , Null , Flags%)
		Canvas=CreateCanvas(5 , 5 , 400, 300 , Window)
		
End Function