[JW Lua] FCCustomLuaWindow
Chris
marcel.denio at gmail.com
Sun Nov 22 15:40:16 CET 2015
Jari
When I execute this script the first time, it's OK.
But after, the execution time increases each time. (and the 10th ...)
(memory is not released ???)
--------------------------
local BTCLOSE = 0
local BTOK = 1
local BTCANCEL = 2
local selectNote =
{"C1","C#1","D1","D#1","E1","F1","F#1","G1","G#1","A1","A#1","B1","C2","C#2","D2","D#2","E2","F2","F#2","G2","G#2","A2","A#2","B2","C3"}
local function createString(texte)
local str=finale.FCString()
str.LuaString = texte
return str
end
--[[
crée toutes les checbox pour "selectNote"
retourne la liste des checkbox
]]
local function createCheckboxNotes(dialog,first,last)
local X,Y,ECARTX,ECARTDIESE,OFFSETVERTTEXT = 200,100,17,10,20
local ret={}
for i = first,last do
local xPtr = X + (i * ECARTX)
local yPtr = Y
local text = selectNote[i + 1]
if #text > 2 then yPtr = yPtr - ECARTDIESE end
local cb = dialog:CreateCheckbox(xPtr ,yPtr)
cb:SetWidth(10)
table.insert(ret,cb)
local staticText = dialog:CreateStatic(xPtr,Y + OFFSETVERTTEXT)
staticText:SetText(createString(text))
end
return ret
end
local cw = finale.FCCustomLuaWindow()
cw:CreateOkButton()
cw:CreateCancelButton()
local listCheckbox = createCheckboxNotes(cw,0,23)
local ret = cw:ExecuteModal(nil)
if ret == BTCLOSE then
print("close")
elseif ret == BTOK then
print("ok")
elseif ret == BTCANCEL then
print("cancel")
end
--------------------------
(and when I close the dialog with the cross, it's return CANCEL and not
CLOSED)
Best regards
Chris
More information about the JWLua
mailing list