PixInsight Forum

PixInsight => General => Topic started by: TinySpeck on 2019 February 16 19:17:12

Title: Script slider not working
Post by: TinySpeck on 2019 February 16 19:17:12
I've almost got my first script going, except for one little detail: my slider control doesn't do anything.  The numeric data doesn't update when I move the slider, the tool tip doesn't appear when I hover over the slider or numeric data, and the onValueUpdated function of the NumericControl doesn't get called.

My script runs without console messages if I don't move the slider, but if I move the slider and then click OK I see
** Warning [162]: C:/Program Files/PixInsight/include/pjsr/NumericControl.jsh, line 314: reference to undefined property this.parent.edit
*** Error [022]: C:/Program Files/PixInsight/include/pjsr/NumericControl.jsh, line 322: TypeError: this.parent.sliderValueToControl is not a function

on the console.

I based my script originally on PolarCoordinates.js, which doesn't have any user controls, but I copied the NumericControl code from  AberrationSpotter.js into my dialog GUI code, and it seems to run okay.  I've been comparing my script to others with sliders and I can't see any differences which would explain this.  I've checked my #includes too.  I've been poking and experimenting for a couple hours now and can't get it going.

Does this ring a bell for anyone?  What am I missing?  Thanks for any help!
Title: Re: Script slider not working
Post by: Juan Conejero on 2019 February 18 12:48:56
Hi Gerrit,

This sounds like a mix of PixInsight versions, or at least a mix of files from different versions of the PJSR platform. Can you share your code so I can analyze the problem?
Title: Re: Script slider not working
Post by: TinySpeck on 2019 February 18 18:21:00
Thanks for the offer, Juan, but I just figured it out by a painful process of paring my script and a functional one down to bare essentials.  My script (and PolarCoordinates.js) creates a horizontal sizer for each slider control and then adds those sizers into the overall dialog vertical sizer.  If I eliminate the slider horizontal sizer and simply add the entire slider NumericControl object into the dialog vertical sizer everything is fine.  So just the way the sizers were built up caused the slider to not work.

Yeah, I know, this doesn't make much sense.  That's why it was so difficult to track down.  But the problem is solved now.