Several times over the last few months I have accidently hit something on the keyboard that causes the method name I am working on to change to Constructor. I don’t notice until I try and run the code, and Xojo complains that the method no longer exists. Usually I can get going again by renaming the method back to the original name, but the most recent time I’m still having problems with code not working as expected. What am I pressing that causes my method name to be overwritten with ‘Constructor’?
probably the C key or the down arrow when the method signature inspector combo box has focus
Probably the escape key while the method name is highlighted. Doing so brings up a list of inherited methods to be overridden, with constructor often the first one. Pressing enter while this list is up will change the name to whatever the first result is.
Thanks, those are things to watch for, but I would have had no reason to have the focus on the method name. It would be helpful if there was a way to lock the name, like you can lock positions. I don’t really understand why I would want to use a constructor, but it seems to me it, and all the other choices in the drop down menu, would be unlikely to be selected once a method name had already been assigned, especially if the method name was already being called from other parts of the code.
The IDE has no knowledge that you are / are not using the name when you write code.
As far as it knows there’s “text” that makes up your project (it has some smarts but not about what your code does or doesn’t use in many cases)
When you hit run all the text that makes up your project is gathered up and handed to the compiler - IT then figures out if you are / are not using the name and, as you noted, gives you an error.
are you on Windows ?
There is a bug where if you roll the mouse wheel it can change the name