-
Radio buttons
Hi to all,
I am having a hard time with radio buttons for my UI…
Using the “res” method, I have two radio button for A and B settings on a few properties (position and rotation).I later use if statements to set these values on my properties in the main function.
My problem these if statements seem to not do what they are supposed to do and make the script ignore the rest of the code.
This happens wherever I place them, even right after my position and rotation variables are declared.
The weird part, is I put alerts in the if statements, and they work fine ! (which means my position and rotation variables lose their reference ?)Can someone please help me figure out how to use the radio buttons in the main script ?
Many thanks in advance ????
Here’s a resumed version of my script :{
function myScript(thisObj) {
function myScript_buildUI(thisObj) {
var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "MAGNIFY MASK", [0, 0, 300, 300]);res = "group{orientation:'column', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\
myGroup: Group{orientation:'column', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\
myStaticText: StaticText{text:'Magnify Mask'},\
HorRadioButton: RadioButton{text:'Horizontal'},\
VertRadioButton: RadioButton{text:'Vertical'},\
myStaticTextTwo: StaticText{text:'Copies ?'},\
CopiesEditText: EditText{text:'1'},\
myStaticTextThree: StaticText{text:'Lines ?'},\
LineCheckbox: Checkbox{text:'Lines ?'},\
LineStaticText: StaticText{text:'Number of Lines ?'},\
LineEditText: EditText{text:'1'},\
myStaticTextFour: StaticText{text:'Bevel ?'},\
BevelCheckbox: Checkbox{text:'Bevel ?'},\
myStaticTextFive: StaticText{text:'Blur ?'},\
BlurCheckbox: Checkbox{text:'Blur ?'},\
myButton: Button{text:'Go !'},\
},\
}"// Adds resource string to panel
myPanel.grp = myPanel.add(res);// default
myPanel.grp.myGroup.HorRadioButton.value = true;// Assign function to UI elements
myPanel.grp.myGroup.myButton.onClick = function (){
var UIgroup = myPanel.grp.myGroup;
................
.......CODE......
.................if(UIgroup.HorRadioButton.value == true){
alert("OK");
mRot.setValue(180);
mPosY.setValue(cHeight/10);
mPosX.setValue(-100);
};if(UIgroup.VertRadioButton.value == true){
alert("no");
mRot.setValue(-90);
mPosY.setValue(100);
mPosX.setValue(cWidth/10);
};................
.......CODE IGNORED......
.................}
};// Setup panel sizing and make panel resizable
myPanel.layout.layout(true);
myPanel.grp.minimumSize = myPanel.grp.size;
myPanel.layout.resize();
myPanel.onResizing = myPanel.onResize = function () {this.layout.resize();}return myPanel;
}// Build script panel
var myScriptPal = myScript_buildUI(thisObj);if ((myScriptPal != null) && (myScriptPal instanceof Window)) {
myScriptPal.center();
myScriptPal.show();
}
}// Execute script
myScript(this);
}