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

MathGroup Archive 2010

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

Search the Archive

Re: Custom dialog during evaluation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111718] Re: Custom dialog during evaluation
  • From: Nate Dudenhoeffer <ndudenhoeffer at gmail.com>
  • Date: Wed, 11 Aug 2010 04:47:32 -0400 (EDT)

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.

Nate

On Tue, Aug 10, 2010 at 2:55 AM, Nate Dudenhoeffer <dudenhoeffer at wisc.edu>wrote:

> I would like to have a custom dialog appear while an evaluation is in
> progress (maybe even add that familiar spinning flower).  I know it is easy
> for an experienced user to see when Mathematica is working, but this would
> help novice users who use some of my notebooks.
>
> Does anyone have suggestions on how to do this?  I can use CreateDialog,
> but
> how do I close the dialog when the evaluation is done?  DialogReturn only
> seems to work if it is contained in the dialog, and if the entire
> evaluation
> is contained in the CreateDialog, then the dialog doesn't appear until the
> evaluation is complete.
>
> Any suggestions would be appreciated.
>
> Thanks,
> Nate
>
>
>


  • Prev by Date: Re: A new graphic user interface
  • Next by Date: Re: A new graphic user interface
  • Previous by thread: Re: Custom dialog during evaluation
  • Next by thread: Re: Custom dialog during evaluation