Skip to main content
Nik Ska
Known Participant
June 29, 2013
Question

Script window redraw

  • June 29, 2013
  • 1 reply
  • 4497 views

I'd like to add/remove elements from script window on button click. Is this possible?

This topic has been closed for replies.

1 reply

Known Participant
June 29, 2013

Yes It is. As far as I know

Just take a look at this method wondowObj.layout.layout(true)

Hope it is what you are looking for.

Inspiring
July 1, 2013

I think UI items have a "visible" attribute or something like that. Hiding the item is safer than deleting it if you're planning on making it re-appear later on.

Legend
September 9, 2013

Thank you Xavier, for the suggestion.  I think I will try to integrate your second example.  It seems like the least complicated. 

Going through all of this, I am left with the question of how to save the 'state' of the ui when a user "OK"s the window.  Since this particular ui is a modal, and has a good deal of user interaction, I want to save the state of the UI so that when they bring it back up, it's as if they never left it.  I thought that I would make a global variable that stored an object describing the state of the UI.  Is that the best practice?


Pretty good idea Xavier.

I am left with the question of how to save the 'state' of the ui when a user "OK"s the window.

I usually use the native pref file for stuff like this. Depending on the setup I will also use dedicated text docs instead, but that's more involved.

app.settings.haveSetting("myScriptPrefCategory", "myControl");     //Check for saved pref value

app.settings.saveSetting("myScriptPrefCategory", "myControl", "controlValue");     //Saves a pref value

app.settings.getSetting("myScriptPrefCategory", "myControl");     //Retrieves a pref value

Depending on how many controls you are trying to save, you can setup an array of the master control objects, then loop through them grabbing the values. If you have a variety of control types (dropdownlist vs. checkbox) then things get a little more complicated, but still doable.