MathGroup Archive 2008

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

Search the Archive

Re: RadioButton Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91114] Re: [mg91079] RadioButton Question
  • From: "Namrata Khemka" <namrata.khemka at gmail.com>
  • Date: Wed, 6 Aug 2008 05:07:50 -0400 (EDT)
  • References: <200808050804.EAA09949@smc.vnet.net>

Hi Chris,The following works:

RadioButtonBar[Dynamic[x], {1 -> "Existing", 2 -> "New"}]


Dynamic[x]


Thanks

Namrata




On Tue, Aug 5, 2008 at 2:04 AM, Chris Degnen <degnen at cwgsy.net> wrote:

> 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: Re: RadioButton Question
  • Next by Date: Re: Evaluate part of rhs of RuleDelayed
  • Previous by thread: RadioButton Question
  • Next by thread: Re: RadioButton Question