MathGroup Archive 2008

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

Search the Archive

RE: Event when clicking one of many Disks in a Pane

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87477] RE: [mg87435] Event when clicking one of many Disks in a Pane
  • From: "Jose Luis Gomez" <jose.luis.gomez at itesm.mx>
  • Date: Fri, 11 Apr 2008 01:46:20 -0400 (EDT)
  • References: <200804100615.CAA10868@smc.vnet.net>

(* I have two suggestions for you: Button[] and Mouseover[] *)
(* First using Button[] and Dynamic[] *) 
 
even1 = True;
even2 = True;
Graphics[{
  Button[{Dynamic[If[even1, Red, Yellow]], Disk[{1, 1}, 0.5]}, 
   even1 = Not[even1]],
  Button[{Dynamic[If[even2, Green, Brown]], Disk[{2, 2}, 0.5]}, 
   even2 = Not[even2]]
  }]

(* Second using Mouseover[]. It is not exactly what you asked for, but it
might be useful for you *)

Mouseover[
  Graphics[{Red, Disk[{1, 1}, 0.5]}], 
  Graphics[{Yellow, Disk[{1, 1}, 0.5]}]
]

(* I hope it helps *)
(* Jose *)
(* Mexico *)


-----Mensaje original-----
De: robert prince-wright [mailto:robertprincewright at yahoo.com] 
Enviado el: Jueves, 10 de Abril de 2008 01:15 a.m.
Para: mathgroup at smc.vnet.net
Asunto: [mg87435] Event when clicking one of many Disks in a Pane

Can someone help me figure out how to use EventHandler
to evaluate an expression when one of many Disk[]
objects in a Graphics Pane is clicked.

For example suppose I create a red and green disk in a
graphic:

Graphics[{Red, Disk[{1, 1}, 0.5], Green, Disk[{2, 2},
0.5]}]

Each disk is a separate and editable object in the
graphics pane. Can I therefore associate an Event with
a Mouseclick on each disk? To make matters simple lets
say the disk change color from Red to Yellow and Green
to Brown.




Robert Prince-Wright
Houston
TX, 77006
USA

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



  • Prev by Date: Re: A Problem with Simplify
  • Next by Date: Re: max and min
  • Previous by thread: Event when clicking one of many Disks in a Pane
  • Next by thread: Re: Event when clicking one of many Disks in a Pane