I have several radio buttons in my dialog, supposedly belonging to different groups. But when one is selected, ALL others are deselected.
Is there a way to define radio button groups that don't interfere with each other?
Chris
Honestly, I don't even see how Illustrator could know that the buttons are meant to belong to different groups. Let's say I define 2 radio buttons in the script like so:
var radio1 = new RadioButton(dialog){
text: "Radio 1",
checked: true,
onClick: function(){
radio2.checked = false;
}
}
var radio2 = new RadioButton(dialog){
text: "Radio 2",
checked: false,
onClick: function(){
radio1.checked = false;
}
}
And later on, in a different place in the script, I define 2 different radio buttons:
var selection1 = new RadioButton(dialog){
text: "Selection 1",
checked: true,
onClick: function(){
selection2.checked = false;
}
}
var selection2 = new RadioButton(dialog){
text: "Selection 2",
checked: false,
onClick: function(){
selection1.checked = false;
}
}
I'm not quite sure why I specified the onClick behaviour in the first place... seems to work just fine without it.
I didn't find any means of specifying groups for the radio buttons in the reference.
Thanks!
Chris
Try creating another control in between the two groups, or try grouping them within a Frame.
To see how to use these things maybe have a look at the Core/JavaScript/gui code, e.g. main.js
Apparently ADM should handle the groups automatically, but only if they are numbered consecutively and separated as groups.
Unfortunately the UI / ADM stuff is on its way out as Adobe has chosen to deprecate in CS5 and remove it entirely in CS6, in order to finally switch to Cocoa / 64 bit. Therefore we start looking for alternative and will not spend a lot of time fixing bugs in existing UI code.
...But as a solution for the time in-between I am working on a Dialog.createPalette method that receives the same parameters as Dialog.prompt but creates a floating palette for scripts that is not modal. This should fulfil the needs for most scripts anyway. In Dialog.prompt, an alternative to radio buttons is a popup menu list where only one item can be chosen. Maybe you'd want to wait for this feature?