Re: RadioButton Question
- To: mathgroup at smc.vnet.net
- Subject: [mg91100] Re: RadioButton Question
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 6 Aug 2008 05:05:10 -0400 (EDT)
- References: <g791ks$9ot$1@smc.vnet.net>
Hi,
hu, that sound complicated, what is with
RadioButtonBar[Dynamic[x], {1 -> "Existing", 2 -> "New"}]
Regards
Jens
Chris Degnen 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[]]]}]
>
>