I’m testing a possible transfer of some controls from Xojo to a plugin (it’s my first try to develop a serious plugin). I’m trying two different solutions:
a) implementing them as subclasses of RectControl by using REALcontrolDefinition
b) implementing them as subclasses of Canvas by using REALclassDefinition
Since I’m only interested in implementing subclasses in Cocoa, but also want to compile for Windows and Linux, the latter case is more interesting. There would be no necessity to implement the Windows and Linux part like one has to do when subclassing from RectControl.
I did some test over the weekend to decide on this. Everything works well, only the control subclassed from REALclassDefinition is not showing on runtime, though it does properly behave in the IDE.
First I looked at all the properties in Xojo in the debugger: they give back the correct values, methods do too, and I can also set properties and query them, everything works fine - the control is just not showing (though Visible is True).
Then through declares I queried the Objective C Runtime instances. They also gave me the correct values, for example:
- the superview is equivalent of the Handle property of the Xojo canvas
- the frame is equivalent of the Bounds property of the Xojo canvas (it also resizes correctly when the canvas resizes)
When I try the same in Xojo (adding an NSView to a Canvas subclass with the help of “Declare” statements), the added NSView is showing. Why does the Canvas subclass not show, when adding the NSView to a Canvas subclass in a plugin? I’m using the exact same commands (“alloc”, “initWithFrame:”, “addSubview:”, etc.).