I have a window called Prefs that I’ve added to my project. I’m getting an error message in Prefs.name when I try to Run. The message is:
‘rcvTest’ needs to have a constructor with the signature Constructor () to be placed on a window
(i.e. Prefs is on line 2 of this message).
Using a small example project, I made myself a working Task-Class based on an example supplied with Xojo, along with other examples from this Forum. That all appeared to be working OK, so I’ve added it to my main project as a project control. And I’ve added an instance of that to the Prefs window, just as I did in the example, and renamed it rcvTest. Then I get the error message above. I’ve tried to add a Constructor() method to rcvTest, using the Insert menu, but the method gets added to the Prefs window and a call to super.Constructor() is put in by the IDE. And doing that makes no difference; the error message still appears. What do I need to do here?
What class is rcvTests super ?
That would be the one you need to add a no param constructor to
rcvTest’s super is my TaskClass, which already has a constructor that I’ve added so I can initialise the timer and so on for the task aspects. OK, <furtle, furtle> hmm yes that seems to have fixed it, although I don’t understand why. From what I read I might have expected to need to put, in my own Constructor method, a statement:
which I also tried to no avail.
If you drag an instance onto a layout there needs to be a away for that layout to, at runtime, create that instance
That requires a constructor
If the only constructor you have requires parameters then the layout has no means to divine what those parameters might be, which properties or instances might be the required parameters etc
So you MUST have a no parameter constructor in any class you want to drag onto a layout
Thats what that complaint from, the compiler is about
Not that your task class didn’t call super.constructor but that it does not have a no parameter constructor on the class itself