MathGroup Archive 2012

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

Search the Archive

Re: Button Behavior OnClick

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125482] Re: Button Behavior OnClick
  • From: David Reiss <dbreiss at gmail.com>
  • Date: Thu, 15 Mar 2012 00:30:59 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jjpaog$p19$1@smc.vnet.net>

One possible approach, following your lead:

DynamicModule[
 {APressed = Automatic, BPressed = Automatic},

 Row[
  {Button[
    "Option A", (APressed = "Pressed"; BPressed = Automatic;
     Print[10!]), Appearance -> Dynamic[APressed]],
   Spacer[10],
   Button[
    "Option B", (BPressed = "Pressed"; APressed = Automatic;
     Print[10!]), Appearance -> Dynamic[BPressed]]}]

 ]


--David


On Mar 14, 1:36 am, Scott Colwell <scolw... at uoguelph.ca> wrote:
> This seems like it should be simple enough to do, but I can't figure it out.
>
> How do you get a button to look like it is pressed only when it has been pressed, and then unpressed when another button is selected.
>
> Seems to me there should be a simple OnClick command that says If A is pressed, then make A looked pressed but not B. If B is pressed, then make B look pressed but not A. I can sort of get the effect with mouseover but it doesn't stay.  Any ideas?
>
> Row[{
>   Mouseover[Button["Option A", Print[10!]],
>    Button["Option A", Print[10!], Appearance -> "Pressed"]],
>   Spacer[10],
>   Mouseover[Button["Option B", Print[10!]],
>    Button["Option B", Print[10!], Appearance -> "Pressed"]]
>   }]




  • Prev by Date: Re: Unexpected Output When Plotting...
  • Next by Date: Re: Possibly related to my post "Unexpected Graph Output"...
  • Previous by thread: Re: Button Behavior OnClick
  • Next by thread: Re: Button Behavior OnClick