Copy link to clipboard
Copied
title = '享像派',
contents = content,
blockTask = true,
onShow = function()
end,
windowWillClose = function()
end
})
How to close presentFloatingDialog with onShow function
Copy link to clipboard
Copied
Please repost this in the SDK forum and I'll answer there: Lightroom SDK . That will ensure that other developers will see the question and answer.
Copy link to clipboard
Copied
Discussion successfully moved from Lightroom Classic CC — The desktop-focused app to Lightroom SDK
Copy link to clipboard
Copied
Here's what the API documentation says:
So the definition of the "onShow" function would have this structure:
LrDialogs.presetFloatingDialog (_PLUGIN, {...
onShow = function (t)
...save t in a persistent object or global variable...
end
...})
When the code wants to close the dialog, it calls t.close().
Copy link to clipboard
Copied
I am trying to figure out the onShow function also. Can you please elaborate on how to "save t in a persistent object or global variable"?
I tried :
onShow = function(t)
tofront = t
end
and:
onShow = function(t)
tofront = t["toFront"]
end
But none of these seem to be doing anything.
Copy link to clipboard
Copied
I figured it out once I got a better grasp of Lua global variables. Here is the fix, in case anyone else may be wondering.
First, create a global variable with a name of your choosing. In my case it was "floatingDialog". This can be placed anywhere before invoking the dialog.
_G["floatingDialog"] = {}
Then, when calling the floating dialog, save the parameter of the onShow function to that global variable:
LrDialogs.presentFloatingDialog(_PLUGIN,
{
title = "My Dialog Title",
contents = contents,
onShow = function(toFront)
_G["floatingDialog"] = toFront
end
}
)
Copy link to clipboard
Copied
Methods to fix-
Method 1: Using controls on the dialog box
Usually the dialog box contains information for the user to read and few options according to the information.
Via GUI:
You can choose one of the options or directly click on the “X” symbol on the top-right corner of the dialog box.
Via Keys:
If you are used to command-line and are not comfortable with using a mouse, you can press “Esc” key to cancel the dialog box. If you prefer to select the options given, use the “tab/arrow” key(s) to navigate between the options and press enter when the chosen option is highlighted.
Note: The user input would directly close the dialog box.
Method 2: To handle struck dialog boxes
Sometimes the dialog box gets struck and we will not be able to go ahead. In such cases, save the current work and close the entire application to start again.
Using the task bar:
Right-click the icon referring to the dialog box from the Windows taskbar and click “Close”.
Using the Task Manager:
Open the Task Manager using the search bar(“ctrl + alt + del”), right-click on the application that you want to close and click on “End task”.
Greeting,
Rachel Gomez