Hi,
I am trying to add OSC support to the CalibrateAlign script. The necessary image meta data is different from mono CCD data and I have tried to switch between sets of FITS keywords using a
checkbox. The TreeBox and column headers display is OK for the first time but when the box is checked or unchecked the column width is not set correctly. The test code is separated because of the length of the script.
// 1 - global vars
var FrameTypeMono = new Array();
FrameTypeMono[Imagetype.BIAS] = ["XBINNING"];
FrameTypeMono[Imagetype.DARK] = ["XBINNING", "EXPTIME"];
FrameTypeMono[Imagetype.FLAT] = ["XBINNING", "FILTER"];
FrameTypeMono[Imagetype.LIGHT] = ["XBINNING", "FILTER"];
var FrameTypeOSC = new Array();
FrameTypeOSC[Imagetype.BIAS] = ["XBINNING"];
FrameTypeOSC[Imagetype.DARK] = ["XBINNING", "EXPTIME"];
FrameTypeOSC[Imagetype.FLAT] = ["XBINNING"];
FrameTypeOSC[Imagetype.LIGHT] = ["XBINNING"];
var FrameType;
// 2 - GUI control
this.useOSCCheckBox = new CheckBox(this);
this.useOSCCheckBox.text = "OSC/DSLR support";
this.useOSCCheckBox.toolTip = "<p>Use OSC/DSLR support</p>";
this.useOSCCheckBox.onCheck = function(checked)
{
for(var j = 0; j <= Imagetype.LIGHT; ++j)
this.dialog.clearTab(j);
if(checked == true)
FrameType = FrameTypeOSC;
else
FrameType = FrameTypeMono;
this.dialog.refreshTreeBoxes();
};
// 3 - refresh TreeBoxes
// added for OSC support - (re)calculate table headers
// calculate number of columns and set column headers
for(var i = 0; i <= Imagetype.LIGHT; ++i)
{
this.dialog.tabBox.pageControlByIndex(i).treeBox.numberOfColumns = FrameType.length;
for(var j = 0; j < FrameType.length; ++j)
{
this.dialog.tabBox.pageControlByIndex(i).treeBox.setHeaderAlignment(j, Align_Left);
this.dialog.tabBox.pageControlByIndex(i).treeBox.setColumnWidth(j, trim(FrameType[j]).length * 10); // monospace 10 font set
this.dialog.tabBox.pageControlByIndex(i).treeBox.setHeaderText(j, trim(FrameType[j]));
}
this.dialog.tabBox.pageControlByIndex(i).treeBox.setColumnWidth(j + 1, 10 * 20); // 20 characters * 10 font size
this.dialog.tabBox.pageControlByIndex(i).treeBox.setHeaderText(FrameType.length, "Filename");
}
Best,
Kai