Show me cool, obscure languages!View other answers to this thread
Learn Something New Everyday,
Connect With The Best Developers!
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:
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:
Create another subclass of Animal, called Dog, and also add the SpeakSound event handler with this code:
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 MsgBox(a.Speak) Next
When you run this code, you will see “Meow!” and then “Woof!”.