Skip to main content
Known Participant
March 11, 2016
Answered

sliders instead of buttons

  • March 11, 2016
  • 1 reply
  • 312 views

I have about 20 scripts buttons that take up space,

I was wondering if it was possible to create a slider that if set to 1

did from the function 1

win.testOK.funcrion1Btn.onClick = function () {

if set to 2

did as the function 2

win.testOK.funcrion2Btn.onClick = function () {

etc. etc.

doing it this way would save a lot of space and I could

create more pleasant interface

This topic has been closed for replies.
Correct answer Chuck Uebele

You can, but I think a dropdownlist would be better. on either of those, you just put an onChange function that will run the code you want.

var list = ['1. first','2. second','3. third'];

dlg = new Window('dialog','test');

dlg.dropLst = dlg.add('dropdownlist',undefined,list);

dlg.dropLst.onChange = function(){

    switch(parseInt(dlg.dropLst.selection)){

        case 0:

            //code here

            alert(dlg.dropLst.selection.text);

            break;

        case 1:

            //code here

            alert(dlg.dropLst.selection.text);

            break;

        case 2:

            //code here

            alert(dlg.dropLst.selection.text);

            break;       

        }   

    }

dlg.show();

1 reply

Chuck Uebele
Community Expert
Chuck UebeleCommunity ExpertCorrect answer
Community Expert
March 11, 2016

You can, but I think a dropdownlist would be better. on either of those, you just put an onChange function that will run the code you want.

var list = ['1. first','2. second','3. third'];

dlg = new Window('dialog','test');

dlg.dropLst = dlg.add('dropdownlist',undefined,list);

dlg.dropLst.onChange = function(){

    switch(parseInt(dlg.dropLst.selection)){

        case 0:

            //code here

            alert(dlg.dropLst.selection.text);

            break;

        case 1:

            //code here

            alert(dlg.dropLst.selection.text);

            break;

        case 2:

            //code here

            alert(dlg.dropLst.selection.text);

            break;       

        }   

    }

dlg.show();

Known Participant
March 11, 2016

much much better

thank you