• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

close presentFloatingDialog

New Here ,
Oct 22, 2018 Oct 22, 2018

Copy link to clipboard

Copied

LrDialogs.presentFloatingDialog(_PLUGIN, {

  title = '享像派',

  contents = content,

  blockTask = true,

  onShow = function()

  

   end,

  windowWillClose = function()

  

   end

  }) 

How to close presentFloatingDialog with onShow function

TOPICS
SDK

Views

466

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 22, 2018 Oct 22, 2018

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 22, 2018 Oct 22, 2018

Copy link to clipboard

Copied

Discussion successfully moved from Lightroom Classic CC — The desktop-focused app to Lightroom SDK

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 22, 2018 Oct 22, 2018

Copy link to clipboard

Copied

Here's what the API documentation says:

  • onShow: (Function, optional) If supplied, a function which will be called when the dialog first shows up on the screen. It will be passed a single argument; a table containing two entries, which are both functions that can be invoked to manipulate the dialog. The 'toFront' entry is the function to call to ensure that the dialog is the frontmost window immediately after the call. The 'close' entry is the function to call to programmatically close the dialog window.

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().

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 16, 2022 Sep 16, 2022

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 20, 2022 Sep 20, 2022

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
    }
)

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines