I want a loop that gets executed (at max speed) once a (MUI) button got pressed until the stop (MUI) button got pressed.
Here's the code how I thought it would work:
Code: Select all
@REQUIRE "MUIRoyale"
@FILE 1, "async.xml"
@DISPLAY {Hidden = True} ;{width=200, height=200};{Hidden = True}
Function p_start()
While my_quit$= True
counter$=counter$+1
DebugPrint("counter", counter$)
Wend
EndFunction
Function p_EventFunc(msg)
Switch msg.action
Case "MUIRoyale":
Switch msg.attribute
Case "CloseRequest":
End
Case "Pressed":
Switch msg.id
Case "mybt2":
my_quit$= True
p_start()
Case "mybt1":
my_quit= False
EndSwitch
EndSwitch
EndSwitch
EndFunction
mui.createGUI(ReadString(1, FileLength(1)))
InstallEventHandler({MUIRoyale= p_EventFunc})
SetInterval(1, p_EventFunc, 10)
Repeat
WaitEvent
Forever
Code: Select all
<?xml version="1.0" encoding="iso-8859-1"?>
<application base="Async" id="app">
<menustrip id="mymenu">
<menu title="Project">
<item id="menaboutmui" notify="selected" userdata="_void_">About MUI...</item>
<item id="menaboutmuiroyale" notify="selected" userdata="_void_">About MUI Royale...</item>
<item/>
<item id="menquit" notify="selected" userdata="_void_" shortcut="Q">Quit</item>
</menu>
<menu title="Settings">
<item id="menmuiset" notify="selected" userdata="_void_">MUI...</item>
</menu>
</menustrip>
<window title="Async" muiid="MAIN" notify="closerequest" menustrip="mymenu" >
<vgroup>
<hgroup>
<button id="mybt2" notify="pressed" shorthelp="Rename by Exif data">Start</button>
<button id="mybt1" notify="pressed" shorthelp="Stop current operation">Stop</button>
</hgroup>
</vgroup>
</window>
</application>
Is there a way to actively poll a MUI button state? I thought ofsomething like mui.get("mybt2","Pressed") - but it's not working, too.