There is one example in the function reference, moai.CreateApp.
This seem to be like a fully working program, ready to run just by adding require at the top of the script.
What I like about it, from a beginners perspective, is that it has the xlm part in the script so there is no need to have an external xml file in this example.
When running it, it does open a small window with a button, as intended. But looking at the code, it is suposed to output a debugprint message when clicking the button.
But that part is not doing anything, so I wonder what is missing from the example?
Here is the script, unmodified from the docs, exept for adding require "rapagui" at the top.
Code: Select all
@REQUIRE "RapaGUI"
moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application>
<window title="Test program">
<vgroup>
<button>Hello World!</button>
</vgroup>
</window>
</application>
]])
InstallEventHandler({RapaGUI = Function(msg)
If msg.attribute = "Pressed" Then DebugPrint("Button pressed!")
EndFunction})
Repeat
WaitEvent
Forever