Learning from examples, but your code implements something from the super

I loaded up the Block Attack example game last night and had an issue trying to get it to run. I thought it would be a good learning curve to try and debug it, but after playing around with it for about an hour I realised I wasn’t going to get it going.

The error I’m getting is:

[quote]GameWindow.BlockTimer.Run Declaration
BlockTimer on GameWindow implements the event “Run,” but its superclass Timer has already implemented the event.
Sub Run()
[/quote]

Disabling the timer in the inspector doesn’t fix it, I thought that maybe it was firing before the window was open or something… Nope.

In researching it, someone had a similar issue with their own app and it was suggested there was a dependency issue, but I have ruled that out. Whilst I do have dependency issues (No, not alcohol, although I wouldn’t mind a drink about now ;P) that doesn’t appear to be the cause of it since I just did a reboot into my old Ubuntu 18.04 system which have the dependencies that I am missing in Mint 20.02. I got the same “superclass has already implemented the event” error.

any suggestions?

I really do hate this style of learning, it seems it’s something to do with changes in the source code of the controls within xojo since I just tried the combat app and I was getting the same error with it’s timers. I didn’t immediately notice there were three errors, once I deleted the old timers out of the window and added two new timers from the library, those errors disappeared.

The third error:

CombatWindow.StartButton.Pressed Declaration StartButton on CombatWindow implements the event "Pressed," but its superclass PushButton has already implemented the event. Sub Pressed()

So now the button is having problems with it’s superclass and the fact that “Pressed” is being implemented in the combat game window (as an event on the “StartButton” called “Pressed”)

I don’t have an old copy of xojo that I can try testing these with (nor would I have the dependencies anyway), but I really want to understand what’s happening here and what if anything I can do about it.

Do/Can controls break during release updates?

What does it actually mean that the superclass already implemented it? Is it something that’s been overloaded incorrectly?

ARRRGH

I deleted the button and re-added it and got the name right and inserted the code “StartGame” (long code! lol)

But then as soon as I went to run the package again I got new errors:

App.Opening Declaration
You cannot implement a nonexistent event
Sub Opening()

and

CombatWindow.Opening Declaration
You cannot implement a nonexistent event
Sub Opening()

Looking to debug that…

Ahh, ok, the app and the window were both using “Opening” events and over time these have been replaced with “Open” events.

I fixed that and restarted it. It builds and comes onto the screen, but doesn’t work. Nothing happens upon pressing the start button. The code looks correct, but I will move on, I was only curious, but I shouldn’t waste any more time on this code that’s obviously not supported anymore.

there was some renaming at api 2.
are you using xojo2019r3.1 and his examples?

I’m my own worst enemy.

I didn’t let it go…

I went back and fixed the Block Game:

  • I removed and re-added the timer and made all the settings correct
  • I removed the “Opening” Events and replaced them with “Open” events.

The game now runs! Cool, Ran it, played it for 2-3 minutes and moved on (again)…

But, yeah, I didn’t… Something doesn’t smell right.

I go through and open up other examples, examples I KNOW I have run without a problem last week (in the case of the SQLite database one, I only ran it a couple of days ago. (retrospect: it turns out there are several SQLite demos and I’ve unknowingly been comparing 2 different versions, one is regularly fine, the other is regularly NOT fine)

But it’s not running today.

I’m getting all these same errors again, Buttons implementing “Pressed” events when the superclass has already implemented it.

Yes, I have upgraded my system (Ubuntu 18.04 to Mint 20.04 in the last 24 hours), but I am sure I ran the SQLite application in Xojo 2019R3.2, perhaps it was in 2019R3.1.

These examples, (and I tested a few) all worked in 2019R3.1 on Ubuntu 18.04. I am now about to reboot into 18.04 again and start these examples in both 3.1 and 3.2 and see what happens. Work out if it’s the distribution or not

G’day @Markus Rauch , I have summed it up in my last paragraph, but to be clear, it’s unclear… still working on it, I have an updated post coming shortly, I’ve had a dozen reboots in the last hour testing all sorts of versions and OSs (it’s mostly looking like Xojo not supporting Mint20, but there’s more to it than that, I have failures in Ubuntu 18.04 as well.

One set of problems is coming from Mint20 (but is likely to be a problem in other 20.04 distros
Another set of problems is coming from 2019R3.2 as opposed to 2019R3.1.

Almost everything I tested in U18 R3.1 worked (except SQLBackup, have to reconfirm, I need another reboot and probably wont bother tonight… but knowing me, I probably will) :frowning:
A lot of what I tested in U18 R3.2 didn’t work, but the text document I saved the info in exited without saving (user error) which is why I need to reboot again (I’ve gone back to that system 3 times already).

I’m not rebooting again, here’s the best recollection I can provide at this second:

M20, X32, I have not run the examples before now, and they are mostly broken (mostly seems to be dependency issue)*
U18, X31, Examples worked fine
U18, X32, SQLExample runs, SQLBackup doesn't, games don't
W10, X31 combat works, didn't bother testing others, can assume they work
W10, X32 tested quite a few, all worked
OSX X31 - All worked
OSX X32 - All Worked
----------------
X31/X32 = Xojo 2019R3.1 and 2019R3.2 resp
M20 = Mint 20
U18 = Ubuntu 18.04
W10 = Guesses?
OSX = You know :)
  • I was about to install 2019R3.1 on this system but I have the .deb file which wont install because of dependency issues, and I never downloaded the tgz for it. I would like to confirm where the problem lies, but that’ll do it for this thread

i read the changelog for R3.2 it was only for apple users so i not installed this version.

hmm interesting … all examples should work …

I’ve been slowly getting to the bottom of this, and I didn’t initially believe it was API2.0 related, but after some deep digging, I think that it may be…

I think it could be to do specifically with libwebkitgtk. I just need to spin up a VM for some testing :stuck_out_tongue:

Anywhere that you see a “Pressed” event for a button, you should move the code from that event into the Action event, and then deleted the Pressed event.

For 2019r2, Xojo wanted to rename the Action event as Pressed, but that caused some developers with existing apps, seriou sproblems, so they reverted that in 2.1.

However: it could be that they left the Pressed event in too and didn’t revert all the examples.

Same with Opening, change to Open.

I started this post quite a few hours ago, as a result of the confusion and frustration I went and detailed everything quite precisely with hashes and even a video! The link to the other thread and video are at the bottom of this post

Guys, I am seriously at a loss, but at least the outcome is good.

Right now, EVERYTHING seems to be working, and I’m not sure why. I’ve just run though several projects and they’re all good.

For example, the 2K game… working. Now I have not opened this game on the computer. Keep in mind I only installed the system yesterday and installed xojo yesterday and so the number of projects I tested on here were pretty limited. 2K was NOT one of the projects I tested. I went back and tried all the ones that failed yesterday and today they are working.

Convinced I am now going mad I have renamed my xojo2019r3.2 to something else and I have unpacked the original tgz archive and sure enough, the projects are failing.

Loading in 2K and I am getting the “…implements the event “Pressed”, but it’s superclass…” error again. Out of curiosity, I remove the “pressed” event and add an “Action” event and paste the code in there. Now I am getting the same errors on “Opening” and “closing”…

I am not about to go through and change all this now, and I didn’t do it last night either. Yet, in the 2019r3.2 backup directory, the projects are working.

These are the same files I downloaded yesterday…

I am very confused…

The only thing that I recall doing in the last 24 hours, besides countless reboots, is install the feedback app and install the pre-release… Nothing else. What I have done is run a lot of the examples in the pre-release and they worked. I was surprised so I went back and checked 2019r3.2 and they worked there… And by all rights, they shouldn’t have! (which is why I grabbed them from the archive again and once more they are broken).

This would seem to indicate that something I have done has updated the examples somehow?

I created a new thread specifically dealing with the project example files:

(Old forum: http://forum.xojo.com/61522-my-example-files-are-messed-up/0 )