BUT: clicking in the area left or right of the thumb in the slider will only trigger a "level" notification, but not a "release" notification, and therefore the jump will never be triggered in my code. The same goes when holding the mousebutton left or right from the thumb, which will do several steps, trigger a "level" notification for each one of them but never a "release" notification.
Imho, the solution would be to send a "release" notification when releasing the mouse button after clicking or holding it on the slider but not on its thumb.
I tested out this on Windows, btw.
Some more questions:
- Is there a way to set the step? On Windows, clicking left or right from the thumb always does a step of 10, on MUI (OS4) the step is 1.
- Double clicking the thumb on OS4 sets the slider to 0. Is that intended behaviour or a bug?
Test.hws:
Code: Select all
@REQUIRE "RapaGUI", {Link = True}
@APPTITLE "Slider-Test"
@FILE 1, "TestGUI.xml"
Function p_Log(t$)
moai.DoMethod("log", "insert", "bottom", GetTime(True) .. ": " .. t$)
moai.DoMethod("log", "jump", "bottom")
EndFunction
Function p_EventFunc(msg)
Switch(msg.ID)
Case "slsetval":
moai.Set("slider", "level", moai.Get("slsetvalnum", "text"))
Case "slsetrange":
moai.Set("slider", "max", moai.Get("slsetrangenum", "text"))
Case "slider":
Switch(msg.Attribute)
Case "Level":
moai.Set("sllevel", "text", msg.triggervalue)
p_Log("slider level: " .. msg.triggervalue)
Case "Release":
p_Log("slider released")
EndSwitch
EndSwitch
EndFunction
moai.CreateApp(ReadString(1))
InstallEventHandler({RapaGUI = p_EventFunc})
Repeat
WaitEvent
Forever
Code: Select all
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
<window id="mainWindow" title="Slider-Test">
<vgroup>
<hgroup>
<vgroup frame="true" frametitle="Slider demo">
<colgroup columns="2">
<label align="center">Current value</label>
<text id="sllevel" frame="true">0</text>
<button id="slsetval">Set value</button>
<textentry id="slsetvalnum" accept="0123456789">0</textentry>
<button id="slsetrange">Set range</button>
<textentry id="slsetrangenum" accept="0123456789">100</textentry>
</colgroup>
<rectangle/>
</vgroup>
<slider id="slider" notify="level; release"/>
</hgroup>
<listview id="log">
<column/>
</listview>
</vgroup>
</window>
</application>