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

Help with the user interface: Run Script while selecting Radio and Checkbox option "Part II"

Engaged ,
Apr 10, 2017 Apr 10, 2017

Copy link to clipboard

Copied

Hello guys! Thanks to you and especially to our friend Chuck Uebel, gradually I am finished my beautiful dialog box to configure and save images for large print formats: Now I am looking for a practical and automatic way to disable or freeze the event of the Checkbox button when I choose the second radio buttons option. I could just uncheck the checkbox, but I'd rather avoid a click more and also learn how to do this procedure. Thank you.

Illustration:

Screenshot_1.gif

Follow the Script:

var w = new Window ("dialog", "Save Print Settings"); 

    w.orientation = "column";       

    w.alignChildren = "top";  // insert this line   

 

var g1 = w.add('group') 

       g1.orientation = 'row'; 

 

    var radio_group  = g1.add ('panel', undefined, "Print"); 

    var radio_group2  = g1.add ('panel', undefined, "Formact");

        // Radio 

        radio_group.alignChildren = "left"; 

        radio_group.add ("radiobutton", undefined, "Outros"); 

        radio_group.add ("radiobutton", undefined, "Banner"); 

        radio_group.add ("radiobutton", undefined, "Canvas"); 

       

        radio_group2.alignChildren = "left"; 

        radio_group2.add ("radiobutton", undefined, "Save TIFF     "); 

        radio_group2.add ("radiobutton", undefined, "Save PDF"); 

        radio_group2.add ("radiobutton", undefined, "Save PNG"); 

   

    var btnGroup = g1.add("group");     

        btnGroup.orientation = "column"; 

        btnGroup.alignment = ['left','top'];   

        btnGroup.add ('button', {x:90, y:125, width:80, height:25}, 'Ok', {name:'ok'}); 

        btnGroup.add ('button', {x:240, y:125, width:80, height:25}, 'Cancel', {name:'cancel'}); 

        var g3 = w.add('group') 

        g3.orientation = 'row'; 

        g3.alignment = ['left','top'];   

        var list = g3.add('panel',undefined,'Config. Complementares');   

        list.orientation = 'row';   

       

        // listDropdown

        list.orientation = "row";

        list.add ("statictext", undefined, "Marg:");

        var listDropdown = list.add ("dropdownlist", undefined, ["Default","2cm", "4cm","5cm","10cm"]);

        var bt_LGroup = w.add ("group");

        bt_LGroup.orientation = "column";

        listDropdown.selection = 0;

       

        // checkbox

        list.orientation = 'row';   

        list.alignChildren = ['left','top'];   

        var check1 = list.add('checkbox',undefined,'ID Client');   

        check1.value = true;

// Validação Dropdow list

listDropdown.onChange = function(){ 

switch(parseInt(listDropdown.selection)){ 

    case 0: // Black

    //------------------------------

     {alert('Default')}

    //------------------------------

    break; 

      

    case 1: // White

    //------------------------------

     {alert('2cm')}

    //------------------------------

    break; 

      

    case 2: // Custom 

    //------------------------------

     {alert('4cm')}

    //------------------------------

    break;         

    case 3: // Custom 

    //------------------------------

     {alert('5cm')}

    //------------------------------

    break;   

    case 4: // Custom 

    //------------------------------

     {alert('10cm')}

    //------------------------------

    break;   

    }     

}

// set dialog defaults 

radio_group.children[0].value = true;

radio_group2.children[0].value = true; 

 

radio_group.addEventListener('click', function(evt) { 

    for (var i = 0, _len = radio_group2.children.length; i < _len; i++) { 

        //radio_group2.children.value = false; 

    } 

}); 

 

 

function selected_rbutton (rbuttons) { 

    for (var i = 0; i < rbuttons.children.length; i++) { 

        if (rbuttons.children.value == true) { 

            return rbuttons.children.text; 

        } 

    } 

    return false; 

   

// Linkar com os Scrips.jsx 

if (w.show () == 1) { 

// Ord 1: Adiciona as marcações e ID do cliente

  if(check1.value){

alert('ID')

  }      

//else{alert('checkbox 1 is not checked')}    

// Ord 2: Radio (Tipo de material) Esculta a função  Formato

  var chosenRadioButton = selected_rbutton(radio_group); 

    switch (chosenRadioButton) { 

       // Linkar com os Scrips.jsx   

     case "Outros": 

     {alert('outros')}  

     break; 

     // Linkar com os Scrips.jsx 

     case "Banner": 

      {alert('banner')}  

     break; 

      // Linkar com os Scrips.jsx 

     case "Canvas": 

       {alert('canvas')}  

     break; 

  

}  

// Ord 3: Radio (Formato) Esculta a função salvar 

    var chosenRadioButton = selected_rbutton(radio_group2); 

    switch (chosenRadioButton) { 

     case "Save TIFF     ": 

          {alert('Tiff')}  

     break; 

     // Linkar com os Scrips.jsx 

     case "Save PDF": 

      {alert('pdf')}  

     break;

     // Linkar com os Scrips.jsx 

     case "Save PNG": 

         {alert('png')}  

     break; 

}

TOPICS
Actions and scripting

Views

608

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

correct answers 1 Correct answer

Community Expert , Apr 10, 2017 Apr 10, 2017

Try adding these lines of code at line 94 of your above code:

radio_group.children[1].onClick = function(){

    check1.value = check1.enabled = false;

    }

   

    radio_group.children[0].onClick = function(){

        check1.enabled = true;

        }

   

    radio_group.children[2].onClick = function(){

        check1.enabled = true;

        }  

Votes

Translate

Translate
Adobe
Community Expert ,
Apr 10, 2017 Apr 10, 2017

Copy link to clipboard

Copied

Try adding these lines of code at line 94 of your above code:

radio_group.children[1].onClick = function(){

    check1.value = check1.enabled = false;

    }

   

    radio_group.children[0].onClick = function(){

        check1.enabled = true;

        }

   

    radio_group.children[2].onClick = function(){

        check1.enabled = true;

        }  

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
Engaged ,
Apr 11, 2017 Apr 11, 2017

Copy link to clipboard

Copied

Perfect!Wow, it worked very well. I figured it would be too complicated. You're a genius. Thank you one more time A big hug friend Chuck Uebele

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
Community Expert ,
Apr 11, 2017 Apr 11, 2017

Copy link to clipboard

Copied

LATEST

Glad it worked out.

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