MathGroup Archive 2010

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

Search the Archive

Re: Custom dialog during evaluation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111797] Re: Custom dialog during evaluation
  • From: Nate Dudenhoeffer <ndudenhoeffer at gmail.com>
  • Date: Fri, 13 Aug 2010 06:58:02 -0400 (EDT)

Thanks for the tips Albert.

Needless to say, I didn't test the final before I posted it.  I forgot
module variables don't work in dialogs.

Nate


On Thu, Aug 12, 2010 at 4:31 AM, Albert Retey <awnl at gmx-topmail.de> wrote:

> Am 11.08.2010 10:47, schrieb Nate Dudenhoeffer:
> > I answered my own question.  The key was using NotebookClose, not
> > DialogReturn[].
> >
> > And, since I have far too much time on my hands, here is some code to
> create
> > a dynamic flower that should look familiar to Mac users.  Along with an
> > example of how to use it:
> >
> > myflower := Module[{w, bigD, d},
> >    w = .22;
> >    bigD = 2;
> >    d = 1;
> >    Dynamic[
> >     Graphics[{
> >       Rotate[
> >        Table[
> >         {GrayLevel[Min[{1 - (i/(2*\[Pi])), .8}]],
> >          Disk[{bigD*Sin[i], bigD*Cos[i]}, w],
> >          Polygon[{
> >            {d*Sin[i] - w*Cos[i], d*Cos[i] + w*Sin[i]},
> >            {bigD*Sin[i] - w*Cos[i], bigD*Cos[i] + w*Sin[i]},
> >            {bigD*Sin[i] + w*Cos[i], bigD*Cos[i] - w*Sin[i]},
> >            {d*Sin[i] + w*Cos[i], d*Cos[i] - w*Sin[i]}
> >            }]
> >          },
> >         {i, 0, 2 \[Pi], 2 \[Pi]/12}
> >         ], -Clock[{2*\[Pi]/12, 2*\[Pi], 2*\[Pi]/11}, 2]],
> >       White, Disk[{0, 0}, d*1.1]},
> >      ImageSize -> {250, 250}
> >      ]
> >     ]
> >    ];
> >
> > mydialog = CreateDialog[myflower,
> >    Modal -> True,
> >    WindowTitle -> "Working...",
> >    WindowSize -> All,
> >    WindowMargins -> Automatic,
> >    Background -> White];
> > nd = 1;
> > While[nd < 10,
> >  Pause[1];
> >  nd++
> >  ]
> > NotebookClose[mydialog];
> >
> > I hope someone else finds this useful too.
>
> looks like you are a person who would appreciate these small visual
> enhancements:
>
> mydialog = CreateDialog[
>  myflower,
>  Modal -> True,
>   WindowSize -> All,
>  WindowMargins -> Automatic,
>  WindowFrame -> "Frameless",
>  WindowOpacity -> 0.75,
>  WindowFloating -> True
>  ]
>
> I think WindowOpacity will not work for all OS.
>
> For me the code you posted didn't work right away, and I think this is
> because the Module doesn't behave as you wanted. It think when stuffing
> constants into a Dynamic the use of With is usually the better choice:
>
> With[{
>  w = 0.22,
>  bigD = 2,
>  d = 1
>  },
>  Dynamic[...]
> ]
>
> hth,
>
> albert
>
>


  • Prev by Date: Re: Connecting to remote kernel
  • Next by Date: Re: Frontend suggestions
  • Previous by thread: Re: Custom dialog during evaluation
  • Next by thread: Frontend suggestions