# Use an InputField going with the result of a RadioButon?

Posted 2 years ago
2144 Views
|
|
0 Total Likes
|
 I am looking for a solution for a minor but annoying flaw in a program that I made for building a CDF for analysing the properties of accumulations of random numbers. In the CDF I can choose for several types of such accumulations through a number of radiobuttons. With each radiobutton I can make a list that contains the sum of the accummulation in question along with several parameters and quantities that I for instance need for a text above the final chart of the accumulation and some additional special properties of it. Together with each radiobutton for any accumulation with a certain probability distribution the CDF has one or more inputfields for the necessary parameters, such as mean and standard deviation for a normal distribution. My problem is the following: After pushing a radiobutton and then inserting a number in an inputfield that goes with that button, and then hitting Enter or clicking with the mouse outside of the input field, the radiobutton turns white and in order to make the number in the input field do its work I have to push this radiobutton anew. What I want is that the new situation is activated right away after entering a number in the inputfield and then pushing Enter of clicking with the mouse outside of the inputfield. I hope there is a solution for this. This is the program all the way stripped down to the relevant section: Export["Testpanel.cdf", CreateDocument[{ DynamicModule[{y, beta, center, standarddeviation, mean}, Row[{ Row[{ Dynamic[ SeedRandom[1]; RadioButton[ Dynamic[y], {" Laplace", " distribution", " ", Accumulate[ RandomVariate[LaplaceDistribution[center, beta], 1000]], 0}]], TextCell[" Laplace "], center = 0; InputField[Dynamic[center], FieldSize -> 3], beta = 1.7; InputField[Dynamic[beta], FieldSize -> 3], TextCell[" "], Dynamic[ SeedRandom[1]; RadioButton[ Dynamic[y], {" normal", " distribution", " ", Accumulate[ RandomVariate[NormalDistribution[mean, standarddeviation], 1000]], 0}]], TextCell[" Normal "], mean = 0; standarddeviation = 1; InputField[Dynamic[mean], FieldSize -> 3], InputField[Dynamic[standarddeviation], FieldSize -> 3], TextCell[" "] }], Dynamic[Show[ ListPlot[ Partition[Riffle[Range[1, 500], y[[4]][[1 ;; 500]]], 2], PlotStyle -> {PointSize[0.003], White}, Background -> Black ], ImageSize -> 500]] }] ]}]] Additional information: In the meantime I discovered that after putting a new number in an inputfield instead of hitting Enter or clicking outside of the inputfield and then pushing the radiobutton again one may also get desired result by right away pushing the Radiobutton 3 times. So in fact my problem may be considered as solved.