Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hello,
When you use a slider to represent a range of numbers is there a way to get the numbers to show up on the bottom of the slider; where the tick marks are?
D
Solved! Go to Solution.
I don't think it can be done automatically within Mathcad.
Mike
hrm.... ok
Thanks Mike
You might like the attached worksheet. It allows you to pre-define the Min, Max and Steps in the slider without going into the properties.
Mike
Yes that looks good. How do you set that up? Is it in properties?
D
The properties of the slider component is set via the VBscript interface. You will find details of what you can set via that route under Help>>Developer's reference.
To get at the script simply right click on the slider and select Edit Script. (if it doesn't show in the right click menu you haven't quirte selected the correct bit of the slider - the context sensitivity can be annoying 😉
In the example file the MaxRange could/should be Slider.MaxRange for improved clarity.
If you are inserting a slider from fresh you also have to "add input variable" (right click) to get the number of inputs you desire.
In this case there is one input, a vector, which has 3 individual values. Thankfully VB starts at zero just like Mathcad (0..2).
Whether you use one vector or many separate inputs is a personal choice. Using a single vector allows all the parameters to be collected into a single mathcad variable (saves having to 'insert matrix', transpose it, enter the three parameters etc to get the pretty display used in this case...)
You can also simply copy and paste the example.....
Finally, in the example if you set step to zero then (obviously) you get an error. However it won't clear unless you pretend to edit the script!.
Philip
All done within the script, Philip has provided an excellent explanation above.
Mike
Mike,
Philip was right. When i copied your example I got an error message that says "Microsoft script runtime error" . I have attached a screen shot of the error message. I tried changing the min input from zero to 10, and I pretended to edit the script like Phillip instructed. No luck.
Thanks,
D
Right click on the slider and click edit script. There is a tick at the top of the script page (Apply) click that and see if that works.
I have just downloaded the file again and it works for me.
Mike
Mike,
I tried what you said. I must be missing something. I attached a copy of what I put in the edit script section.
I thank you for your patience,
D
Why have you changed the MinRange within the script to 10?
The MIN variable can be changed at worksheet level.
Mike
Mike,
I changed it because when I put the script from your example into the script editor it did not work. I'm not understanding what needs to change. Phillip said that I would get an error if i put in zero. So I changed it to 10. When I put in the script that you created I assumed it would look like the one you sent me. I thought the min and max would show up on the worksheet. Perhaps I'm missing a step.
Again your help is appreciated,
D
I think your getting a little mixed up.
Philip said you will get an error if you set step to zero. The step can be set at worksheet level, no need to go into the script.
Can you get my example to work?
Why don't you upload your example and I'll see if I can spot the error.
Mike
You are correct Mike, I am confused. I have attached the worksheet. I'm trying to change the sliders at the top of the worksheet.
D
Have a look at the attached.
Needs tidying up, but the sliders now work.
Mike
Hey Mike,
Did you figure out what was wrong?
D
Sorry about the delay in responding, I have been mad busy in work.
Mike
Second revision cleaned up a little.
Mike
This might be what you had in mind...if it is not clear, then ask before tonight for clarification, else await my return next Tue...also, Mike et al. can help w my simple example...
~R~
The only reason I kept the MIN, MAX AND STEPS variables defined at worksheet level was to remove the need of descriptive text and allow any user to easily change the range without going into the properties of the slider.
Mike
Thanks. I finally got it:-)
D
Better(?) late than never dept. Jumping into this late, but here's a scrollbar version (original courtesy of Richard) of a slider which has been a workhorse of mine for quite a while. It's set up to accept input parameters of min, max, and # of steps at the worksheet level, as input parameters under the scrolbar. The two elements of the output vector give the value and step number. Negative step numbers give log spacing of the values as fct of scrollbar position.
Its key advantage over the built-in slider, and the reason it's been so valuable to me, is that the value is live; you don't need to move the focus outside the control to have the value update (the whole point of a slider in my opinion). The downside is that I've found it to be so abominally slow in V14 (as many calcs in general) compared to v11 that I almost never use v14 and stick to v11 for almost everything. But in v11, I have found the scrollbars don't limit response time; only any resulting complex calc. chains that need to respond.
Lou
Nice example.
Mike
Yes, I see your point. OTOH, I often think that engineering docs like this one have much too little by way of internal documentation, anyway, so I'm in favor of including more. And seeing Min, Max, and Steps still doesn't let the user know what those all mean, so some sort of note is necessary, IMO. I had never done much more than the simplest use of these controls, but it seems that they do more than I thought they would. Matter of individual preference, I suppose, because even going through the GUI to set the parms, you still don't know the units (still needs a note). A nice side trip for me today...;-)
Yes, I see your point. OTOH, I often think that engineering docs like this one have much too little by way of internal documentation, anyway, so I'm in favor of including more.
Rich, being an engineer I totally agree with you regarding information inside documents. I regularly produce design documents which have to be self explanatory.
Personally I wouldn't use a slider in a calculation because it wouldn't mean anything when the calc is printed. I would use a slider for a program so an input variable could be changed easily.
BTW, every variable I define is always accompanied by text.
Mike