Page 1 of 1

Creating ContextMenus at runtime on LInux

Posted: Fri Jan 18, 2019 3:02 pm
by evil
I want to change the contextmenu of an object at runtime.
Area.ContextMenu has the applicability of IS.
On AmigaOS3 everything works well, but on Linux (could not test on Win/Mac)
the Menus are shown, but their events arent handled.
A Bug??

Best regars

George

A small code-snippet:

Code: Select all

@REQUIRE "RapaGUI"
xml$=[[
    <?xml version="1.0" encoding="iso-8859-1"?>
    <application id="app">
        <menu title="Menu" id="ctxmenu">
            <item id="req1">Requester 1</item>
            <item id="req2">Requester 2</item>
            <item id="quit">Beenden</item>
        </menu>

        <window>
            <hgroup>
                <button id="testbutton">TestButton</button>
                <rectangle/>
            </hgroup>
        </window>
    </application>
]]

Function p_eventfunc(msg)
    Switch msg.id
        Case "req1" moai.request("Ok","Requester 1","Ok")
        Case "req2" moai.request("Ok","Requester 2","Ok")
        Case "quit" end()
    EndSwitch
EndFunction

InstallEventHandler({Rapagui=p_eventfunc})

moai.createapp(xml$)
moai.set("testbutton","contextmenu","ctxmenu")
Repeat
    WaitEvent()
Forever

Re: Creating ContextMenus at runtime on LInux

Posted: Sat Jan 19, 2019 5:43 pm
by airsoftsoftwair
Yes, it's a bug. Happens on Windows too. Will be fixed, thanks for reporting!

Re: Creating ContextMenus at runtime on LInux

Posted: Sat Jan 19, 2019 6:15 pm
by evil
Okay. Thank you!

Re: Creating ContextMenus at runtime on LInux

Posted: Sun Dec 22, 2019 2:16 pm
by airsoftsoftwair

Code: Select all

- Fix [Windows/macOS/Linux]: Setting Area.ContextMenu didn't work correctly for context menu which hadn't
  been initialized yet