4 Replies Latest reply: Feb 9, 2009 9:57 PM by John.Kordas RSS

    CS3 JS Radio button layout

    John.Kordas Community Member
      In all the examples I've seen the radio buttons align vertically.

      Is it possible to align then horizontally?
        • 1. Re: CS3 JS Radio button layout
          pkahrel Community Member
          With scriptUI, yes.

          Peter
          • 2. Re: CS3 JS Radio button layout
            John.Kordas Community Member
            Thanks Peter,

            Did a bit of a search on scriptUI and found a couple by Dave Sanders.

            In his example he codes the dialog;

            myDlg = new Window('dialog', 'Drop-down List');
            myDlg.orientation = 'column';
            myDlg.alignment = 'right';
            //add drop-down
            myDlg.DDgroup = myDlg.add('group');
            myDlg.DDgroup.orientation = 'row';

            The test I was working on is as follows:

            function myDisplayDialog(){
            var myDialog = app.dialogs.add({name:"Radio layout"});
            //Add a dialog column.
            with(myDialog.dialogColumns.add()){
            var myRadioButtonGroup = radiobuttonGroups.add();
            with(myRadioButtonGroup){
            var myFirst = radiobuttonControls.add({staticLabel:"One", checkedState:true});
            var mySecond = radiobuttonControls.add({staticLabel:"Two"});
            }
            }
            //Show the dialog box.
            var myResult = myDialog.show();
            }

            myDisplayDialog();

            So is it possible to do somthing like:
            with(myRadioButtonGroup.orientation = "row" ){

            or should i be following the format Dave has in his example?
            • 3. Re: CS3 JS Radio button layout
              pkahrel Community Member
              John,

              Dave's example is scriptUI, yours uses InDesign's dialog system. The latter doesn't let you organise buttons in rows, you have to use scriptUI. Here's your example in scriptUI:

              function myDisplayDialog()
              
                 {
                var myDialog = new Window ('dialog', "Radio layout");
                 var rg = myDialog.add ('group')
                    var rb1 = rg.add ('radiobutton', undefined, 'Button 1');
                    rb1.value = true;
                    var rb2 = rg.add ('radiobutton', undefined, 'Button 2');
                 myResult = myDialog.show();
                 }

              myDisplayDialog();


              scripUI's documentation is in the ESTK: Help > SDK > JavaScript's Toolguide CS3. scriptUI's object model is at Help > scriptUI classes.

              Peter
              • 4. Re: CS3 JS Radio button layout
                John.Kordas Community Member
                Thanks Peter,

                That's what I was after.

                Much appreciated.