CreateApp vs CreateGUI
Posted: Wed Mar 01, 2023 8:39 pm
Hi,
I've been having problems with FreeApp() and CreateApp() in RapaGUI so narrowed it down to the minimum code to ask for help. The following code works fine on AROS but freezes the app after 1 to 10 button presses on OS3.9 under WinUAE. Can anyone verify the issue? The code after this is the same but converted to MUIRoyale. That works fine on both AROS and OS3.9. What's going on? Thanks for the help.
NathanH
I've been having problems with FreeApp() and CreateApp() in RapaGUI so narrowed it down to the minimum code to ask for help. The following code works fine on AROS but freezes the app after 1 to 10 button presses on OS3.9 under WinUAE. Can anyone verify the issue? The code after this is the same but converted to MUIRoyale. That works fine on both AROS and OS3.9. What's going on? Thanks for the help.
NathanH
Code: Select all
RapaGUI code ##############################################################################
@DISPLAY 1, {Hidden=True}
@APPIDENTIFIER "1.2.3.4"
@REQUIRE "rapagui"
mode=True
Function p_CreateGUI()
moai.FreeApp()
If mode
moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
<window id="wi_main" title="GUI 1" notify="CloseRequest" open="1">
<vgroup>
<text>This is long text so that we can see the name of the window.</text>
<button id="bt_gui" notify="pressed">Switch to 2</button>
</vgroup>
</window>
</application>
]])
Else
moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
<window id="wi_main1" title="GUI 2" notify="CloseRequest" open="1">
<vgroup>
<text>This is long text so that we can see the name of the window.</text>
<button id="bt_gui" notify="pressed">Switch to 1</button>
</vgroup>
</window>
</application>
]])
EndIf
EndFunction
Function p_EventFunc(msg)
Switch msg.Action
Case "RapaGUI":
Switch msg.Class
Case "Window":
End()
Case "Button":
Switch msg.id
Case "bt_gui":
mode=Not mode
p_CreateGUI()
EndSwitch
EndSwitch
EndSwitch
EndFunction
Same code but in MUIRoyale ##################################################################
@DISPLAY 1, {Hidden=True}
@REQUIRE "muiroyale"
mode=True
Function p_CreateGUI()
mui.FreeGUI()
If mode
mui.CreateGUI([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app" base="TEST">
<window id="wi_main" title="GUI 1" muiid="MAIN" notify="CloseRequest" open="1">
<vgroup>
<text>This is long text so that we can see the name of the window.</text>
<button id="bt_gui" notify="pressed">Switch to 2</button>
</vgroup>
</window>
</application>
]])
Else
mui.CreateGUI([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app" base="TEST">
<window id="wi_main" title="GUI 2" muiid="MAIN" notify="CloseRequest" open="1">
<vgroup>
<text>This is long text so that we can see the name of the window.</text>
<button id="bt_gui" notify="pressed">Switch to 1</button>
</vgroup>
</window>
</application>
]])
EndIf
EndFunction
Function p_EventFunc(msg)
Switch msg.Action
Case "MUIRoyale":
Switch msg.Class
Case "Window":
End()
Case "Button":
Switch msg.id
Case "bt_gui":
mode=Not mode
p_CreateGUI()
EndSwitch
EndSwitch
EndSwitch
EndFunction
p_CreateGUI()
InstallEventHandler({MUIRoyale=p_EventFunc})
Repeat
WaitEvent
Forever
p_CreateGUI()
InstallEventHandler({RapaGUI=p_EventFunc})
Repeat
WaitEvent
Forever