Show me cool, obscure languages!

View other answers to this thread

Learn Something New Everyday,
Connect With The Best Developers!

Sign Up Now!

& 500k+ others use Hashnode actively.

Paul Lefebvre's photo

Xojo fits the bill. A couple cool features:

  • Native, cross-platform desktop apps from a single project file
  • Event Handling

Animal example using events

Create a new class called Animal. Add to it a Speak method that returns String with this code:

Return SpeakSound

Now add to the Animal class an Event Definition called SpeakSound and set its return value to String.

Next, create a subclass of Animal, called Cat. Click on the button “+” button on the toolbar and select “Add Event Handler”. In the dialog, you will see the SpeakSound event handler. Select and and press OK. The code for this event handler is:

Return "Meow!"

Create another subclass of Animal, called Dog, and also add the SpeakSound event handler with this code:

Return "Woof!"

To test this, create a button on a window. In the Action event of the button add code to create an array of Animals:

Dim animals() As Animal
animals.Append(New Cat)
animals.Append(New Dog)

For Each a As Animal In animals

When you run this code, you will see “Meow!” and then “Woof!”.

Want to read more?

Browse featured discussions

© 2020 · Hashnode