Javascript - setting radio button values when visibility of panels toggled
I have a dialog which has two panels, each with a group containing radio buttons :
dlgPrefs.pnlControls1.grpOptions.rbt1
dlgPrefs.pnlControls1.grpOptions.rbt2
dlgPrefs.pnlControls1.grpOptions.rbt3
dlgPrefs.pnlControls2.grpOptions.rbt1
dlgPrefs.pnlControls2.grpOptions.rbt2
dlgPrefs.pnlControls2.grpOptions.rbt3
dlgPrefs.pnlControls2.grpOptions.rbt4
dlgPrefs.pnlControls2.grpOptions.rbt5
I use another button to 'toggle' the visibility of the two panels :
dlgPrefs.btnToggleVis.onClick = function() {
if (dlgPrefs.pnlControls1.visible) {
dlgPrefs.pnlControls1.visible = false;
dlgPrefs.pnlControls2.visible = true;
dlgPrefs.pnlControls2.grpOptions.rbt4.value = true; // default when pnlControls2 is visible
} else {
dlgPrefs.pnlControls1.visible = true;
dlgPrefs.pnlControls1.visible = false;
dlgPrefs.pnlControls1.grpOptions.rbt3.value = true; // default when pnlControls1 is visible
};
};
When I toggle the visibility of the panels I want to 'set' a radio button to be 'on' in the newly visible panel (in the example above it is rbt4 if pnlControls2 is visible, or rbt3 if pnlControls1 is visible).
My problem is that no matter what I've tried, whenever the visibility toggles I always get the last values that were manually set by the user (ie last clicked remains 'on').
Any advice would be greatly appreciated, following which you will probably hear me loudly going 'Doh!' from afar.
PS I've hunted high and low for a solution online and in these forums and read the Photoshop Scripting Guide and Photoshop Javascript Reference from start to finish. If anyone can recommend other resources that are more appropriate/comprehensive I'd appreciate that info too!
