The Event Pressed is also defined by WebContainer. You must resolve this conflict

I’ve got this error with xojo 2025r21. was not happening in previous version

see attached project.

https://tracker.xojo.com/xojoinc/xojo/-/issues/79798

testpressed.xojo_binary_project.zip (9.0 KB)

Maybe because Xojo added a pressed event?

1 Like

sure but I created an event definition pressed, and the compiler does not allow it ?

If you want to use your defined event, you have to consume the native event in the subclass.

Or just delete the defined event and the RaiseEvent line to use the new native event.

1 Like

You don’t need the event definition.

The same happens if I subclass a WebButton and define Opening and try to use it:

Or just implement the Pressed event on your custom container.

another way you can deal with this is to use AddHandler. That would allow you to conditionally implement the new event based on the version of xojo that you are using and wouldn’t break backward compatibility with older IDEs. Something like this in the Opening event…

#if XojoVersion >= 2025.01
  AddHandler Self.Pressed, AddressOf pressedHandler 
#endif

And then you’d just need to have a method called pressedHandler there to accept the event in newer versions

3 Likes

If you add an eventhandler you see “Pressed” in that event make sure you call you event definition again:

In your ‘Event Handler’:

RaiseEvent Pressed

That calls your ‘event definition’ and allow you to have a single pressed event handler.

This applies if there is already an event with a certain name, and you want to re-used that or overwrite it.

Assuming you want the default behavior.