CreateApp example not working?

Discuss GUI programming with the RapaGUI plugin here
Post Reply
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

CreateApp example not working?

Post by amyren »

I see the need to learn myself to use RapaGUI, and been looking at some of the included examples.

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
plouf
Posts: 467
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: CreateApp example not working?

Post by plouf »

button has no id to trigger to

change the button line to

Code: Select all

         <button id="set_your_id_here">Hello World!</button>
Christos
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: CreateApp example not working?

Post by amyren »

Thanks, that was it. Now it does what it should.
I guess the RapaGUI documentation should be updated accordingly.
Post Reply