-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibraryMenuItem.lua
More file actions
36 lines (33 loc) · 1.28 KB
/
LibraryMenuItem.lua
File metadata and controls
36 lines (33 loc) · 1.28 KB
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
local LrFunctionContext = import 'LrFunctionContext'
local LrBinding = import 'LrBinding'
local LrDialogs = import 'LrDialogs'
local LrView = import 'LrView'
local LrColor = import 'LrColor'
MyHWLibraryItem = {}
function MyHWLibraryItem.showCustomDialog()
-- body of show-dialog function
LrFunctionContext.callWithContext( "showCustomDialog", function( context )
-- body of called function
local props = LrBinding.makePropertyTable( context ) -- create bound table
props.isChecked = false -- add a property key and initial value
-- create view hierarchy
local f = LrView.osFactory()
local c = f:row { -- the root node
bind_to_object = props, -- bound to our data table
-- add controls
f:checkbox {
title = "Enable", -- label text
value = LrView.bind( "isChecked" ) -- bind button state to data key
},
f:edit_field {
value = "Some Text",
enabled = LrView.bind( "isChecked" ) -- bind state to same key
},
}
local result = LrDialogs.presentModalDialog({
title = "Custom Dialog",
contents = c, -- the view hierarchy we defined
})
end)
end
MyHWLibraryItem.showCustomDialog()