Copy link to clipboard
Copied
I am trying to make a dynamic user interface by getting data from a web service that creates X amount of check boxes. How do I do this? I read the documentation, but there is no function that allows you to create a UI component and add it as a child of another component. I know it can be done since other plugins have similar functionality.
Copy link to clipboard
Copied
I haven't found any documented method for adding controls to a dialog that's being displayed. But there are techniques you could use to solve your problem:
1. After you get the data and know how many controls you need, close the first dialog and open a second one with the right number of controls.
2. Create the maximum number of controls, setting .visible = false to hide them. Unhide as many as necessary after you've received the data.
Copy link to clipboard
Copied
Hi,
I was asking exactly the same question of fellow plugin developers yesterday and got basically the same answer.
An option 3) to consider to fake the desired UI is to create a grid of controls and simulate a scrolling area using buttons/sliders, so it looks like data is scrolling out of view but in reality you are just shifting all of the data displayed via bound values. Painful, but I believe this is what Jeffrey had to do in some of his plugins.
Matt
Copy link to clipboard
Copied
Yes this is a big drawback of the Lightroom SDK. You can display dynamic data on a static interface, but you cannot create a dynamic user interface.
The best ways to get arond this is use the scrolling idea like before and hiding controls in views and turning on and off the visibility.
Copy link to clipboard
Copied
+1 vote - better UI controls, especially for creating dynamic and non-modal user interfaces...
Copy link to clipboard
Copied
I decided to get the data within the exportServiceprovider.startDialog() function and since I need to connect to a server I am using LrHttp.get() function, i need to use the LrTasks.startAsyncTask() function. So, after getting and processing the results I return the user interface (e.g. f:row {}) and insert it into a table that is then displayed in the exportServiceProvider.sectionsForBottomOfDialog() section. The problem is, it seems, by the time the asynchronous task finishes, it's too late for it to have any effect, since the sectionsForBottomOfDialog seems to be finished already. I also get the following error: ?:0 attempt to call method 'hierarchyCreated' (a nil value). Can this not be done, and is just another limitation of the SDK?
Copy link to clipboard
Copied
Hi,
I saw the hierarchyCreated error just recently and it went away when I restructured part of my code.
If you are passing f:rows from the startDialog() function to the sectionsForBottomOfDialog() function that could be the problem. You might be better off passing the raw table and assembling the f:rows in the function that displays the dialog.
Matt