Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

Merging multiple radio button groups for one possible result

$
0
0

Hey.

 

I have 3 groups each with two radio buttons in. I want only one button to checked at a time, but unfortunately you can still check one button from each group.

From looking online, I've read that they all need to have the same name in order to be part of the same 'radio group'. But no matter where I've put a

.name = "sameGroup"

it hasn't worked.

 

Is this possible? Or do I need to create an eventListener for each button, which unchecks all other buttons upon being clicked.

 

Here is an example of my code below:

 

var w = new Window("dialog", "test", undefined, {}); // create window
// create main group
var radGrpMain = w.add('Group', undefined);
radGrpMain.alignChildren = ['left', ' '];
radGrpMain.orientation = 'row';


// create left sub group
var radGrpL = radGrpMain.add('Group', undefined);
radGrpL.orientation = 'column';
// create mid sub group
var radGrpM = radGrpMain.add('Group', undefined);
radGrpM.orientation = 'column';
// create right sub group
var radGrpR = radGrpMain.add('Group', undefined);
radGrpR.orientation = 'column';

// add buttons
var rad1 = radGrpL.add("RadioButton", undefined, "Radio 1");
rad1.value = true; // default true.
rad1.name = "sameGroup";
var rad2 = radGrpL.add("RadioButton", undefined, "Radio 2");
rad2.name = "sameGroup";
var rad3 = radGrpM.add("RadioButton", undefined, "Radio 3");
rad3.name = "sameGroup";
var rad4 = radGrpM.add("RadioButton", undefined, "Radio 4");
rad4.name = "sameGroup";
var rad5 = radGrpR.add("RadioButton", undefined, "Radio 5");
rad5.name = "sameGroup";
var rad6 = radGrpR.add("RadioButton", undefined, "Radio 6");
rad6.name = "sameGroup";

w.show(); // show window

 

 

Any help appreciated!

 

James


Viewing all articles
Browse latest Browse all 2143

Trending Articles