calling a one line create funciton on the Type is easier
One issue with this is that it is difficult to use it on an extended object using a shared "create".
For example :
Type A
Method Create:A()
' do stuff
End Method
End Type
Type B Extends A
End Type
Here, you can do :
Local obj:B = B(New B.Create())
Rather than having to implement a new Create() function for each subclass, which is what you would have to do using a Function.
I've tended to use both the Function and Method creates in my wxMax implementation. If you want to extend a built-in widget, you must use the method I mention above. Otherwise, you could use the Function or Method to create the instance of the Type.
Implementation looks like this :
Function CreateButton:wxButton(parent:wxWindow, id:Int, label:String = Null, x:Int = -1, y:Int = -1, ..
w:Int = -1, h:Int = -1, style:Int = 0)
Return New wxButton.Create(parent, id, label, x, y, w, h, style)
End Function
Method Create:wxButton(parent:wxWindow, id:Int, label:String = Null, x:Int = -1, y:Int = -1, w:Int = -1, h:Int = -1, style:Int = 0)
wxObjectPtr = bmx_wxbutton_create(Self, parent.wxObjectPtr, id, label, x, y, w, h, style)
OnInit()
Return Self
End Method
where a subclassed button ...
Type MyButton Extends wxButton
...could be created using a call such as :
Local button:wxButton = new MyButton.Create(......)
Keeps things flexible and easy to read.