Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Button Behavior OnClick

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125473] Re: Button Behavior OnClick
  • From: Scott Colwell <scolwell at uoguelph.ca>
  • Date: Thu, 15 Mar 2012 00:27:49 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Thanks John.  Could you please show me how I would integrate that in to the following?

Grid[
 {{
   Text[Style["Compare Multiple Distributions:", Bold, Darker[Blue], 
     FontFamily -> "Ariel", 12]], Spacer[5],
   Row[{}],
   Row[{}],
   Button[Style["Normal v.\n Positive Skew", TextAlignment -> Center],
     Compare = 1, ImageSize -> {115, 45}], Spacer[10],
   Button[
    Style["Normal v.\n Negative Skew", TextAlignment -> Center], 
    Compare = 2, ImageSize -> {115, 45}], Spacer[10],
   Button[
    Style["Positive v.\n Negative Skew", TextAlignment -> Center], 
    Compare = 3, ImageSize -> {115, 45}], Spacer[10]
   }}]

Only 1 of the buttons can be depressed at a time so as 1 is clicked, the others are not.

Thank you.

Scott

----- Original Message -----
From: "John Fultz" <jfultz at wolfram.com>
To: scolwell at uoguelph.ca, mathgroup at smc.vnet.net
Sent: Wednesday, 14 March, 2012 1:57:45 AM
Subject: [mg125473] Re: Button Behavior OnClick

See the last of the "Basic Examples" in the Setter documentation for something
which does exactly this.  SetterBar may also be of some interest to you.

Sincerely,

John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.


On Wed, 14 Mar 2012 00:35:10 -0500 (EST), Scott Colwell 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"]]
> }]



-- 
Scott R. Colwell, Ph.D.
Associate Professor, Dept. of Mkt/Cons Studies
Adjunct Professor, Dept. of Psychology
MINS Building 201a
University of Guelph
Guelph, Ontario, Canada, N1G 2W1



  • Prev by Date: Re: How can I make a sequence that includes lists?
  • Next by Date: Re: ChemicalData and other Scientific and Technical Data
  • Previous by thread: Re: Button Behavior OnClick
  • Next by thread: Possibly related to my post "Unexpected Graph Output"...