Author Topic: PJSR - Aligning entries to 'centre' on spinBox controls  (Read 5179 times)

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
JUan,

Despite your reply to me regarding this bug having been fixed in the transition from v1.4.x to 1.5.0, I am still not able to get the spinBox entries to align to the middle of a suitably sized spinBox control.

I am copying a code snippet to show you the area in my deBayer code where you have already had some input. Am I missing something?

Code: [Select]
   // add SpinBoxes and CheckBoxes, to allow the user to describe the location, order and orientation of the CFA
   // set a minimum width for the offset spinBoxes
   var XYspinBoxWidth = 15 * this.font.width ("0");

   // add a new label for the X-offset SpinBox
   this.CFAxOffset_Label = new Label( this );
   this.CFAxOffset_Label.text = "CFA X-Offset : ";
   this.CFAxOffset_Label.minWidth = labelWidth1;
   this.CFAxOffset_Label.textAlignment = TextAlign_Right|TextAlign_VertCenter;
   this.CFAxOffset_Label.toolTip = "Enter an X-offset to be applied to the CFA";

   // add a new SpinBox to establish the X-offset of the CFA
   this.CFAxOffset_SpinBox = new SpinBox( this );
   this.CFAxOffset_SpinBox.minValue = 0;
   this.CFAxOffset_SpinBox.maxValue = 1;
   this.CFAxOffset_SpinBox.stepSize = 1;
   this.CFAxOffset_SpinBox.value = globalData.CFAcolOffset;

   // ##Note## : There is a bug in v1.4x (i.e, in Qt 4.4) that prevents the following statement from working
   // i.e. it is not possible to 'centre-align' a value within a spinBox
   // ##Query## : HAVING NOW TESTED THIS ON v1.5, THE 'bug' STILL SEEMS TO BE PRESENT. CHECK WITH JUAN
   this.CFAxOffset_SpinBox.textAlignment = TextAlign_Center|TextAlign_VertCenter; // v1.5 onwards ONLY (SEE ABOVE)

   this.CFAxOffset_SpinBox.minWidth = XYspinBoxWidth;
   // ##Note## : the spin boxes must be made larger manually when a suffix is used because PI does not compute their
   // widths correctly (a bug-fix scheduled for PI v1.6, BTW!). The current fix is as per <spinBox.minWidth>, above
   this.CFAxOffset_SpinBox.suffix = " pixel(s)";
   // allow the spinBox to 'wrap round' from min value to max, and vice versa
   this.CFAxOffset_SpinBox.wrapping = true;
   this.CFAxOffset_SpinBox.toolTip = "Enter an X-offset to be applied to the CFA";

   // create a function to respond whenever the SpinBox is changed
   this.CFAxOffset_SpinBox.onValueUpdated = function( index )
   {
      globalData.CFAcolOffset = index;
      generate_workingCFApixelGrid();

      this.dialog.CFACell00_Label.text = workingCFApixelGrid[0][0];
      this.dialog.CFACell01_Label.text = workingCFApixelGrid[0][1];
      this.dialog.CFACell10_Label.text = workingCFApixelGrid[1][0];
      this.dialog.CFACell11_Label.text = workingCFApixelGrid[1][1];
      this.dialog.CFACell20_Label.text = workingCFApixelGrid[2][0];
      this.dialog.CFACell21_Label.text = workingCFApixelGrid[2][1];
      this.dialog.CFACell30_Label.text = workingCFApixelGrid[3][0];
      this.dialog.CFACell31_Label.text = workingCFApixelGrid[3][1];
   }

   this.CFAx_Sizer = new HorizontalSizer;
   this.CFAx_Sizer.spacing = 8;
   this.CFAx_Sizer.margin = 4;
   this.CFAx_Sizer.add(this.CFAxOffset_Label);
   this.CFAx_Sizer.add(this.CFAxOffset_SpinBox);
   this.CFAx_Sizer.addStretch();

   // . . . . . etc.



Cheers,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PJSR - Aligning entries to 'centre' on spinBox controls
« Reply #1 on: 2009 May 26 07:59:29 »
Hi Niall,

All SpinBox problems are now fixed in PI 1.5.2:



It's almost ready, and there are surprises :)
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: PJSR - Aligning entries to 'centre' on spinBox controls
« Reply #2 on: 2009 May 26 15:20:07 »
Thanks for the update Juan
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC