ButtonController

BlitzMax Forums/BlitzMax Beginners Area/ButtonController

Consider the following OOP structure:

Type TToolBtn
	Field poBtn:TButton
	
	Function create:TToolBtn()
		Local b:TToolBtn = New TToolBtn
		b.poBtn = TButton.create(b)
		Return b
	End Function

	Method mouseUp()
		Print "mouse up!"
	End Method
End Type


Type TButton
	Field poMouseCtrl:TMouseCtrl
	Field poCtrl:Object
	
	Function create:TButton(oCtrl:Object)
		Local b:TButton = New TButton
		b.poCtrl = oCtrl
		b.poMouseCtrl = TMouseCtrl.create(b)
		Return b
	End Function
		
	Method mouseUp()
		poCtrl.mouseUp()
	End Method
	
End Type


Type TMouseCtrl
	Field poBtn:TButton
	
	Function create:TMouseCtrl(oCtrl:TButton)
		Local m:TMouseCtrl = New TMouseCtrl
		m.poBtn = oCtrl
		Return m
	End Function
	
	Method update()
		If MouseHit(1) Then poBtn.mouseUp()
	End Method
	
End Type

(it's not really the complete code but you get the idea).

This will not compile, because "Identifier mouseUp() not found." at line
poCtrl.mouseUp()


How can I link a variable type to another type. In this example I want to link a button with a toolbarButton object. In another situation I need to link the same button type to a different object.
I thought I need to use
Object
as a type specifier.