Dynamic contextmenu => freeze

Discuss GUI programming with the MUI Royale plugin here
Post Reply
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Dynamic contextmenu => freeze

Post by sinisrus »

Hello,

I have problem with my script:
Hollwood freeze my amiga

hws

Code: Select all

/* Created with BuildOther v1.0 */
/* By Sinisrus © 2014 */

@VERSION 5,2
@REQUIRE "MUIRoyale"


@DISPLAY 1, {Hidden=True,color=#WHITE}

/********************************************************************/ 

Function  p_EventFunc(msg)

    Switch msg.action
    Case "MUIRoyale":
        Switch msg.attribute
        Case "CloseRequest":
            End

        Case "Pressed":
            Switch msg.id
            Case "addObject":
            mui.DoMethod("groupdyn", "initchange")

              mui.CreateObject([[

              <vgroup id="newgroup" frame="button" backgroundrgb="#0096FF" fixheight="50" inputmode="Relverify" notify="pressed" contextmenu="mymenustrip">
              <rectangle/>
              <text font="big" preparse="\33c">\33b\33P[FFFFFF]Test "ContextMenu" Here!</text>
              <rectangle/>
              </vgroup>
              ]])

              mui.DoMethod("groupdyn", "addTail","newgroup")

            mui.DoMethod("groupdyn", "exitchange", false)

            EndSwitch

        EndSwitch

    Case "HideWindow":
        mui.Set("app", "iconified", True)

    Case "ShowWindow":
        mui.Set("app", "iconified", False)
    EndSwitch

EndFunction

/********************************************************************/  

; dynamically create MUI GUI from an external *.xml file definition
@INCLUDE "Menustrip.xml"

; listen to these events!
InstallEventHandler({MUIRoyale = p_EventFunc})

/********************************************************************/  

EscapeQuit(True)

/* Boucle infinie */
Repeat
        WaitEvent
Forever
xml

Code: Select all

mui.CreateGUI([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app" base="NOUVEAU">

        <menustrip id="mymenustrip">
            <menu title="Menu">
                <item>Renommer...</item>
            </menu>
        </menustrip>

  <window id="win1" width="400" height="400" title="Nouveau" notify="closerequest">
  <vgroup id="groupdyn">

  <button id="addObject" notify="pressed">Add</button>

  </vgroup> 
  </window>

</application>
]])
Thank you
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Dynamic contextmenu => freeze

Post by airsoftsoftwair »

Fixed, thanks.

Code: Select all

- Fix: Area.ContextMenu didn't work with Group objects
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: Dynamic contextmenu => freeze

Post by sinisrus »

I have tested with MuiRoyal 1.7 and selected notify no work (no freeze good)
Have you tested my script?

Code: Select all

/* Created with BuildOther v1.0 */
/* By Sinisrus © 2014 */

@VERSION 5,2
@REQUIRE "MUIRoyale"


@DISPLAY 1, {Hidden=True,color=#WHITE}

/********************************************************************/

Function  p_EventFunc(msg)

    Switch msg.action
    Case "MUIRoyale":
        Switch msg.attribute
        Case "CloseRequest":
            End

        Case "Selected":
            Debugprint("OK")

        Case "Pressed":
            Switch msg.id
            Case "addObject":
            mui.DoMethod("groupdyn", "initchange")

              mui.CreateObject([[

              <vgroup id="newgroup" frame="button" backgroundrgb="#0096FF" fixheight="50" inputmode="Relverify" notify="pressed" contextmenu="mymenustrip">
              <rectangle/>
              <text font="big" preparse="\33c">\33b\33P[FFFFFF]Test "ContextMenu" Here!</text>
              <rectangle/>
              </vgroup>
              ]])

              mui.DoMethod("groupdyn", "addTail","newgroup")

            mui.DoMethod("groupdyn", "exitchange", false)

            EndSwitch

        EndSwitch

    Case "HideWindow":
        mui.Set("app", "iconified", True)

    Case "ShowWindow":
        mui.Set("app", "iconified", False)
    EndSwitch

EndFunction

/********************************************************************/ 

; dynamically create MUI GUI from an external *.xml file definition
@INCLUDE "Menustrip.xml"

; listen to these events!
InstallEventHandler({MUIRoyale = p_EventFunc})

/********************************************************************/ 

EscapeQuit(True)

/* Boucle infinie */
Repeat
        WaitEvent
Forever

Code: Select all

mui.CreateGUI([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app" base="NOUVEAU">

        <menustrip id="mymenustrip">
            <menu title="Menu">
                <item id="newmenu" notify="selected">Renommer...</item>
            </menu>
        </menustrip>

  <window id="win1" width="400" height="400" title="Nouveau" notify="closerequest">
  <vgroup id="groupdyn">

  <button id="addObject" notify="pressed">Add</button>

  </vgroup>
  </window>

</application>
]])
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Dynamic contextmenu => freeze

Post by airsoftsoftwair »

Read the doc. To get notified on context menus, you need to listen to Area.ContextMenuTrigger.
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: Dynamic contextmenu => freeze

Post by sinisrus »

Perfect!

Thank you
Post Reply