-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathslider_control.lua
46 lines (36 loc) · 1.25 KB
/
slider_control.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function plugindef()
finaleplugin.RequireDocument = false
return "0--slider_control.lua"
end
if finenv.IsRGPLua and not finenv.ConsoleIsAvailable then
require('mobdebug').start()
end
local dialog = finale.FCCustomLuaWindow()
local str = finale.FCString()
local static = dialog:CreateStatic(0, 0)
static:SetWidth(150)
local slider = dialog:CreateSlider(0, 30)
slider:SetMinValue(0)
slider:SetMaxValue(10)
slider:SetThumbPosition(2)
str.LuaString = "Thumb position: " .. slider:GetThumbPosition()
static:SetText(str)
dialog:CreateOkButton()
dialog:CreateCancelButton()
dialog:RegisterHandleControlEvent(slider, function(ctrl)
local thumb_pos = ctrl:GetThumbPosition()
str.LuaString = "Thumb position: " .. tostring(thumb_pos)
print(str.LuaString)
static:SetText(str)
end)
dialog:RegisterMouseTrackingStarted(function(ctrl)
local thumb_pos = ctrl:GetThumbPosition()
print("Slider tracking started: " .. thumb_pos)
end)
dialog:RegisterMouseTrackingStopped(function(ctrl)
local thumb_pos = ctrl:GetThumbPosition()
print("Slider tracking stopped: " .. thumb_pos)
end)
local result = dialog:ExecuteModal(nil)
print("ExecuteModal returned: " .. result)
finenv.UI():AlertInfo("Thumb position: " .. tostring(slider:GetThumbPosition()), "")