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

Dynamic script UI changes

Explorer ,
Feb 02, 2012 Feb 02, 2012

pc and mac using CS 5.5.

I was wondering if it was possible to have a UI that can change its appearance when a button is selected. For instance I would like to add a panel to the palette when they select a "turn on filter" button that will display some text boxes and radio buttons that will filter a list. Then if they select the "turn off filter" button I would like to remove the panel that holds all the filter fields and resize the window back to its original size. I've tried a combination of this.layout.layout() and this.layout.resize() after hiding the filter panel, but none seem to resize my palette,  it just leaves a gap where the panel was. The only way I can get it to work is to completely redraw the window but it takes too long due to the long list containted in the list box. Any ideas?

TOPICS
Scripting
3.7K
Translate
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

correct answers 1 Correct answer

Guide , Feb 02, 2012 Feb 02, 2012

As I already suggested you can change the maximumSize property before win.layout.layout(1) to live-resize your UI.

Here is a simple example:

#targetengine 'testShowHidePanel'

var NULL_SIZE = [0,0],

    MAX_SIZE = [1000,1000];

var u,

    w = new Window('palette'),

    // ---

    p1 = w.add('panel'),

    c1 = p1.add('checkbox', u, "My checkbox1"),

    e1 = p1.add('edittext', u, "Edit text1"),

    // ---

    p2 = w.add('panel'),

    c2 = p2.add('checkbox', u, "My checkbox2"),

    e2 = p2.add('edittext', u, "Edit

...
Translate
Guide ,
Feb 02, 2012 Feb 02, 2012

As I already suggested you can change the maximumSize property before win.layout.layout(1) to live-resize your UI.

Here is a simple example:

#targetengine 'testShowHidePanel'

var NULL_SIZE = [0,0],

    MAX_SIZE = [1000,1000];

var u,

    w = new Window('palette'),

    // ---

    p1 = w.add('panel'),

    c1 = p1.add('checkbox', u, "My checkbox1"),

    e1 = p1.add('edittext', u, "Edit text1"),

    // ---

    p2 = w.add('panel'),

    c2 = p2.add('checkbox', u, "My checkbox2"),

    e2 = p2.add('edittext', u, "Edit text2"),

    // ---

    b = w.add('button', u, "Show filter");

p2.visible = false;

p2.maximumSize = NULL_SIZE;

b.onClick = function()

{

    p2.maximumSize = p2.visible ? NULL_SIZE : MAX_SIZE;

    b.text = (p2.visible ? "Show" : "Hide") + " filter";

    p2.visible ^= 1;

    w.layout.layout(1);

};

w.show();

@+

Marc

Translate
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
Explorer ,
Feb 03, 2012 Feb 03, 2012
LATEST

That worked just as you described. Thank you. By any chance would you know if it is possible to create a multicolumn listBox that contains images and populate it on creation?

Thanks again!

Message was edited by: bduffy323

Translate
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