PDA

View Full Version : Altitude and WwControlsBox



SpinMan
04-19-2012, 11:14 AM
I'd like to present the user with a slider to select altitude in 1,000' increments from 1,000 to 100,000 feet. I'd could put in the range as 1-100 but the slider will reflect this range, not the true number. Is there a way to accomplish this?

donb
04-19-2012, 01:04 PM
Hi SpinMan,

Yes, using the range parameter is how you do that. However, as you've likely noticed, if you set the range to 1000 to 100000 then the user can select any value within that range. i.e., there is no corresponding 'increment' associated with the range parameter.

What you might consider is to do some sort of rounding, either up or down, to the nearest 1K value within the callback. If a user slides to 1950, you round to 2000 and then also make a call to WwSetValue on that slider to force it from 1950 to 2000 from within the callback.

Does this help?

Don B.

SpinMan
04-20-2012, 08:15 AM
I wrote a small routine to setup the slider box including the slider_ids keyword and putting them in a common block for the callback. Within the callback i wwgetvalue the slider to extract the long number. With a divide, round, long I round to the nearest 1,000. When I try a WwSetValue(slider_id(0),val) I get a segmentation violation and PV-Wave exits. I put a stop in the callback just before the WwSetValue statement to see what was happening. After displaying the rounded value many times, the following error was thrown: "% Error occurred at WWCONTROLSSETTEXTSLIDER <wwcontrolsbox.pro(107)> (WTSET)."
Then many errors bouncing back and forth between WWSETWIDGET WWSETVALUE and my PLAY procedure. Upon continuing PV-WAVE stops and exits.

PV-WAVE 9.01 Windows NT version 5.1 build 2600

I've used the sliders successfully in the past and I don't have a handle on why this is behaving so poorly. Any ideas?
Thanks!

donb
04-20-2012, 02:12 PM
Can you send your small example to Support (pvwavesupport@roguewave.com (mailto:pvwavesupport@roguewave.com)) so we can take a look at this?

Don B.

SpinMan
04-23-2012, 07:55 AM
On its way!