User Tools

Site Tools


jwlua:customwindow

To create fully-feature dialog user interfaces in JW Lua, use the FCCustomWindow or FCCustomLuaWindow classes. (FCCustomLuaWindow is a subclass of FCCustomWindow that adds Lua callback functionality.)

The dialogs are device independent and uses points as measurement (top-left as the origin). Dialog margins and Ok/Cancel button placement conform to the UI design guidelines for the platform the script runs on.

The following script adds all available types of controls to a dialog.

Windows output:

allcontrols-windows.jpg

Mac output:

allcontrols.lua
local str = finale.FCString()
 
str.LuaString = "JW Lua Control Demo"
local dialog = finale.FCCustomWindow()
dialog:SetTitle(str)
 
str.LuaString = "Text"
 
-- Static text
local static = dialog:CreateStatic(0, 0)
static:SetText(str)
 
-- Edit box
dialog:CreateEdit(0, 16)
 
-- Up/Down control
dialog:CreateUpDown(70, 16)
 
-- Push button
local button = dialog:CreateButton(0, 50)
button:SetText(str)
 
-- List box
local listbox = dialog:CreateListBox(0, 80)
listbox:AddString(str)
listbox:AddString(str)
listbox:AddString(str)
listbox:AddString(str)
 
-- Popup
local popup = dialog:CreatePopup(0, 260)
popup:AddString(str)
popup:AddString(str)
popup:AddString(str)
 
-- Slider
local slider = dialog:CreateSlider(0, 290)
slider:SetMinValue(1)
slider:SetMaxValue(10)
 
-- Checkbox
local checkbox = dialog:CreateCheckbox(0, 330)
checkbox:SetText(str)
 
-- Vertical line
dialog:CreateVerticalLine(170, 0, 340)
 
-- Tree
local tree = dialog:CreateTree(190, 0)
local masternode = tree:AddNode(nil, true, str)
tree:AddNode(masternode, false, str)
tree:AddNode(masternode, false, str)
tree:AddNode(masternode, false, str)
 
-- Data list
local datalist = dialog:CreateDataList(190, 190)
datalist.UseCheckboxes = 
datalist:AddColumn(str, 90)
datalist:AddColumn(str, 90)
local row = datalist:CreateRow()
row:GetItemAt(0).LuaString = "Data 1"
row:GetItemAt(1).LuaString = "Data 2"
 
-- Horizontal Line
dialog:CreateHorizontalLine(0, 350, 390)
 
-- Ok button
dialog:CreateOkButton()
 
-- Cancel button
dialog:CreateCancelButton()
 
-- Display dialog box:
if dialog:ExecuteModal(nil) == 1 then
   -- Ok button was pressed
end
jwlua/customwindow.txt · Last modified: 2015/11/30 12:32 by jariw