Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

RadioButton Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91079] RadioButton Question
  • From: Chris Degnen <degnen at cwgsy.net>
  • Date: Tue, 5 Aug 2008 04:04:31 -0400 (EDT)

Hi, Can anyone suggest how I can get some radio buttons to run
functions, rather than just set a variable?

This is a statement to create two buttons that set a value:-

RadioButtonBar[Dynamic[state], {"Existing", "New"}]


The following code runs functions, but also shows the buttons in a
list, along with some output.  Any suggestions how I can achieve
this functionality but with only the buttons and labels showing, as
above?


dofunction1[] := x = 1;

dofunction2[] := x = 2;

Module[{state = "Existing"},
 {RadioButtonBar[Dynamic[state], {"Existing", "New"}],
  Dynamic[If[state == "Existing", dofunction1[], dofunction2[]]]}]



  • Prev by Date: Call for papers in K-16 Math Education
  • Next by Date: Re: Package conversion to V6
  • Previous by thread: Call for papers in K-16 Math Education
  • Next by thread: Re: RadioButton Question