CreateDisplay With NIL in MUIROYAL

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

CreateDisplay With NIL in MUIROYAL

Post by sinisrus » Wed Jun 14, 2017 4:06 pm

Hello,

I have problem if i use CreateDisplay with NIL

Code: Select all

Test=CreateDisplay(NIL,{HIDDEN=True}) => MuiRoyal no work

Code: Select all

CreateDisplay(1,{HIDDEN=True}) => MuiRoyal Work
MuiRoyal work only if i use ID number

Is there a solution for that?

Thank you

User avatar
airsoftsoftwair
Posts: 2481
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: CreateDisplay With NIL in MUIROYAL

Post by airsoftsoftwair » Fri Jun 16, 2017 11:10 am

Works here. Please post a full test script, but make it as short as possible.

sinisrus
Posts: 217
Joined: Tue Apr 21, 2015 5:43 pm

Re: CreateDisplay With NIL in MUIROYAL

Post by sinisrus » Mon Jun 19, 2017 4:58 pm

Code: Select all

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

test=CreateDisplay(NIL,{Hidden=True,color=#BLACK}) ; <==== I make display named "test"

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

Function  p_EventFunc(msg)
    Switch msg.action
    Case "MUIRoyale":
        Switch msg.attribute
        Case "CloseRequest":
            End
        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
mui.CreateGUI([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app" base="NOUVEAU">
  <window id="win1" width="400" height="400" title="Nouveau" notify="closerequest">
  <vgroup>

<hollywood display="test" minwidth="32" minheight="32" maxwidth="600" maxheight="600"/>

  </vgroup> 
  </window>
</application>
]])

/*************************************************************************/
InstallEventHandler({MUIRoyale = p_EventFunc})
/*************************************************************************/ 

EscapeQuit(True)
/* Boucle infinie */
Repeat
        WaitEvent
Forever

User avatar
airsoftsoftwair
Posts: 2481
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: CreateDisplay With NIL in MUIROYAL

Post by airsoftsoftwair » Tue Jun 20, 2017 6:39 pm

That's a bug in your code. You cannot set Hollywood.Display to a string, but only to a numeric display identifier. The CreateDisplay() result "test" is neither a string nor a number, it is a special internal value that cannot be used from XML. Just do a

Code: Select all

DebugPrint(test)
and you will see this:

Code: Select all

UserData: .....
You have to use numeric identifier for Hollywood.Display.

sinisrus
Posts: 217
Joined: Tue Apr 21, 2015 5:43 pm

Re: CreateDisplay With NIL in MUIROYAL

Post by sinisrus » Wed Jun 21, 2017 4:46 pm

ok

thank you

Post Reply