Linking Objects Field

BlitzMax Forums/BlitzMax Programming/Linking Objects Field

I'm trying to link object fields together, but I keep getting a object is NULL is there something I'm missing with this or am I doing it completely wrong..?


Type TMain Extends TEngine
	Field winMain:TGadget
	Field mnuMain:TGadget
	Field panMain:TGadget
	Field tolMain:TGadget
	Field timer:TTimer
	
	Method Create:TMain()
		Local ww:Int=800, wh:Int=600
		Local wx:Int=(GadgetWidth(Desktop())-ww)/2
		Local wy:Int=(GadgetHeight(Desktop())-wh)/2
		Local ws:Int=WINDOW_TITLEBAR|WINDOW_MENU|WINDOW_CLIENTCOORDS|WINDOW_STATUS
		winMain=CreateWindow("Editor ( Version "+Version+" )",wx,wy,ww,wh,Null,ws)
		Local px:Int=0
		Local py:Int=26
		Local pw:Int=(GadgetWidth(winMain))
		Local ph:Int=(GadgetHeight(winMain))-26
		panMain=CreatePanel(px,py,pw,ph,winMain)
			SetPanelColor panMain,192,192,192
		tolMain=CreateToolBar("icon.png",0,0,0,0,winMain)
		run
		Return Self
	End Method
	
	Method RunTime(event:TEvent)
		Select event.id
		Case EVENT_WINDOWCLOSE
			End
		End Select
	End Method	
End Type

Type TMap Extends TMain
	Field canMap:TGadget
	
	Method Create:TMap()
		Local cx:Int=8
		Local cy:Int=8
		Local cw:Int=512
		Local ch:Int=512
                'ERROR IS HERE!!!
		canMap=CreateCanvas(cx,cy,cw,ch,panMain) 
                'ERROR IS HERE!!!
		timer=CreateTimer(60)
		run
		Return Self
	End Method
	
	Method RunTime(event:TEvent)
		Select event.id
		Case EVENT_TIMERTICK
			RedrawGadget canMap
		Case EVENT_GADGETPAINT
			DrawMap
		End Select
	End Method	
	
	Method DrawMap()
		SetGraphics CanvasGraphics(canMap)
		SetClsColor 255,255,255
		Cls
			SetColor 0,207,0
			DrawLine 0,0,511,0
			DrawLine 0,0,0,511
			DrawLine 511,0,511,511
			DrawLine 0,511,511,511
		SetColor 255,255,255
		Flip
	End Method	
End Type



Once I better understand the way types work in Blitzmax, I will be making a better editor, but for now this is all I know about it :(