Undocumented function: LrDialogs.presentFloatingDialog
This works for displaying non-modal dialog box:
LrFunctionContext.postAsyncTaskWithContext( "test", function( context )
local LrPhotoPictureView = import 'LrPhotoPictureView'
local photo = catalog:getTargetPhoto()
local pictureView = LrPhotoPictureView.makePhotoPictureView{
width = 400, height = 400, photo = photo,
}
local result = LrDialogs.presentFloatingDialog {
title = "Thumbnail test",
background_color = LrColor ("white"), -- required for (uncolored) static_text display, else inside of box is black and so can't see black text.
contents = vf:column {
vf:static_text {
title = photo:getFormattedMetadata ("fileName"),
},
pictureView,
--vf:edit_field { - no sirve, presumably keystrokes are not trapped by box.
-- bind_to_object = prefs,
-- value = app:getGlobalPrefBinding( 'tempForTest' ),
--},
vf:push_button {
title = "Click me",
action = function( button )
app:show{ info="Pushed" } -- glorified call to LrDialogs.presentModalDialog - works.
end,
}
},
}
-- LrDialogs( app:getGlobalPref( 'tempForTest' ), result ) -- no sirve.
end )
Enjoy!
Rob
jarnoh wrote:
there is no way to activate previously opened dialog?
I assume that to be the case, and so it takes a moment to come up if there is much contents.
jarnoh wrote:
Doesn't seem to be really useful
For me, it would be very useful, if it was reliable, but so far, not so good.
UPDATE: Bug I thought was in non-modal dialog is also in modal dialog (scrolled_view must not be followed by another components in tabbed container - see comments in code below):
LrFunctionContext.postAsyncTaskWithContext( "tt", function( context )
local props = LrBinding.makePropertyTable( context )
props.tv = 0
local vi = {
vf:tab_view {
vf:tab_view_item {
identifier = "t1",
title = "T1",
vf:static_text {
title = "temp1"
},
},
vf:tab_view_item {
identifier = "t2",
title = "T2",
vf:scrolled_view {
vf:slider {
bind_to_object = props,
value = LrView.bind( 'tv' ),
},
},
-- with this here, Lr crashes after adjusting slider and then switching tabs - comment it out, and all is well:
--vf:static_text {
-- title = "this cant be here",
--},
},
}
}
LrDialogs.presentModalDialog {
title = "test",
contents = vf:view( vi )
}
end )
R
Message was edited by: Rob Cole
Other differences in Lr5b:
* Non-modal dialogs now have a minimize/maximize doo-hickey next to the red 'X' close button.
* Function context where dialog was created will be cleaned up after creation (in Lr4, it won't be cleaned up until dialog is closed), so make sure you sleep after creating if you need to defer context cleanup.
* Dialog acts like independent window (won't track Lr proper). In Lr4, minimizing Lr main window would minimize non-modal dialogs along with...
Rob
North America
Europe, Middle East and Africa
Asia Pacific