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: [mg87488] Re: Event when clicking one of many Disks in a Pane
  • From: dh <dh at metrohm.ch>
  • Date: Fri, 11 Apr 2008 01:48:25 -0400 (EDT)
  • References: <ftkbd6$bf6$1@smc.vnet.net>


Hi Robert,

here is an example with 2 Disks:

colorDisk[pos_,col1_,col2_]:=DynamicModule[{col=col1},

EventHandler[Graphics[{Dynamic[col],Disk[pos]}],{"MouseClicked":>(col=col/.{col1->col2,col2->col1})}]];

Grid[{{colorDisk[{0,0},Red,Green],colorDisk[{2,0},Blue,Magenta]}}]

hope this helps, Daniel





robert prince-wright wrote:

> 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: Event when clicking one of many Disks in a Pane
  • Next by Date: Re: exporting to multiple sheets in XLS format
  • Previous by thread: Re: Event when clicking one of many Disks in a Pane
  • Next by thread: Re: Pattern problem: How to count from a long list of numbers all