Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: How to connect one object to the other?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88935] Re: How to connect one object to the other?
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Wed, 21 May 2008 14:53:47 -0400 (EDT)
  • References: <g0uait$4uv$1@smc.vnet.net>

On May 20, 12:53 pm, "Gohar Sultan" <contact2go... at gmail.com> wrote:
> i am using Mathematica 6 on Window XP
>
> this code makes disk drag able disk objects, i want to connect them with
> arrow, how con i achieve this, any ideas?
>
> plotObject[G_] := Locator[{RandomReal[30], RandomReal[30]},
>   Graphics[G], ImageSize -> 20]
>
> p = {
>   RGBColor[RandomReal[1], RandomReal[1], RandomReal[1], 0.5],
>   Disk[{5, 5}, 5]
>   }
>
> Framed@Graphics[
>   Table[plotObject[{RGBColor[RandomReal[1], RandomReal[1],
>       RandomReal[1], 0.5], Disk[{5, 5}, 5]}], {i, 10}],
>   PlotRange -> 50]
>

Look up Dynamic in the docs.

Here's an example:

loc = Graphics[{Red, Disk[]}];
pos = {0, 0}
Graphics[{Locator[Dynamic[pos], loc, ImageSize -> Medium],
  Dynamic@Arrow[{{0, 0}, pos}]}, PlotRange -> 1]



  • Prev by Date: Plotting a series of piecewise functions
  • Next by Date: Re: Wolfram Workbench user experiences
  • Previous by thread: Re: Re: How to connect one object to the other?
  • Next by thread: Re: How to connect one object to the other?