Group: | GUI functions |
See also: | readvalue selectitem |
Function: | slidevalue | |
Description: | asks for one or more input values via a dialog box with sliders ; and returns them. |
Usage: | v = readvalue(valuenames, defaults, minima, maxima) | |
Input: | ||
valuenames | a vector of strings explaining the values | |
defaults | a vector of user-defined default values | |
minima | a vector of minima for each of the values | |
maxima | a vector of maxima for each of the values | |
Output: | ||
v | the vector of values selected by the user |
valuenames = "X" | "Y" | "Z" defaults = 0 | 0.3 | -10 minima = 0 | 0 | -100 maxima = 10 | 1 | 100 v = slidevalue(valuenames, defaults, minima, maxima) v
; A dialog box is shown where you can enter your values. ; By selectingthe values are read in and stored ; in a vector v displayed in the output window.
proc() = normaldistribution() m = 1 s = 1 int =(-63:63)/10 d = createdisplay(1,1) data = int~(pdfn((int-m)/s)) show(d,1,1,setmask(data,"line")) while(s > 0) slide = slidevalue("Mean"|"Std. deviation", m|s, -5|0, 5|10) m = slide[1] s = slide[2] deletedata(d,1,1,1) data = int~(pdfn((int-m)/s)) adddata(d,1,1,setmask(data,"line")) endo endp library("plot") normaldistribution()
; A window containing the graph of the standard normal density ; function is opened together with a slidevalue dialog box. In the ; slidevalue window, you can choose the mean and standard ; deviation for the density. Clicking OK the graph is redrawn and the ; dialog window reappears. Selecting the standard deviation equal to ; zero stops the program.