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

MathGroup Archive 2007

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

Search the Archive

Re: Dynamic Timeout

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83555] Re: [mg83480] Dynamic Timeout
  • From: "Thomas Muench" <thomas.muench at gmail.com>
  • Date: Thu, 22 Nov 2007 06:38:20 -0500 (EST)
  • References: <200711210756.CAA05977@smc.vnet.net>

John,

Thank you for your reply, it works very nicely. I experimented with it
a little bit, and found that it is also quite easy to automatically
re-set the DynamicEvaluationTimeout to a shorter time:

 EventHandler[ActionMenu["menu",
    {"file" :>
     (Print[SystemDialogInput["FileOpen"]];SetOptions[$FrontEnd,
DynamicEvaluationTimeout -> 6])
    }], {"MouseDown" :> SetOptions[$FrontEnd, DynamicEvaluationTimeout
-> 1000]},  PassEventsDown -> True]

Sincerly,
thomas

On Nov 22, 2007 2:36 AM, John Fultz <jfultz at wolfram.com> wrote:
> I just posted a response to another user with a similar, and fortunately, more
> soluble problem than what you're dealing with.  In the case of Button[], the
> same problem does arise, but it would be trivially resolvable by setting the
> Method->"Queued" option.  Clearly, ActionMenu ought to have a similar Method
> option.  In version 6, it does not, but it's certainly on our radar for future
> releases.
>
> You can work around it by wrapping an EventHandler[] around your ActionMenu[]
> which resets the DynamicEvaluationTimeout.  The below example is not elegant and
> does not restore the DynamicEvaluationTimeout, but it gives you an idea of how
> to proceed.
>
> EventHandler[
>  ActionMenu[
>   "menu", {"file" :>
>     Print[SystemDialogInput["FileOpen"]]}], {"MouseDown" :>
>    SetOptions[$FrontEnd, DynamicEvaluationTimeout -> 1000]},
>  PassEventsDown -> True]
>
> Sincerely,
>
> John Fultz
> jfultz at wolfram.com
> User Interface Group
> Wolfram Research, Inc.
>
>
> On Wed, 21 Nov 2007 02:56:41 -0500 (EST), thomas wrote:
> > Hello Mathgroup,
> >
> > I have created my own custom Toolbar (DockedCell) with some shortcuts
> > and buttons that I frequently use. One of the items in the toolbar is
> > an ActionMenu which contains calls to some of my own functions. In one
> > of these functions, SystemDialogInput[] is called, with which I can
> > select a subdirectory on my hard drive.
> >
> > ActionMenu is implemented as a Dynamic[] object in Mathematica;
> > therefore, whatever action is triggered by choosing  one of the
> > entries, is subject to the Timeout "feature" of Dynamic[] evaluations.
> > That means that if I am not fast enough when picking my directory,
> > nothing will happen, since the call has timed out. Setting the option
> > SynchronousUpdating->False does not help.
> >
> > What does help is to increase the Timeout-time by setting
> > SetOptions[$FrontEnd,DynamicEvaluationTimeout->10000] or some other
> > high number.
> >
> > My problem is: I do not usually want the timeout to be that large, the
> > normal setting of 5 or 6 seconds is quite reasonable. What I can do,
> > then, is to automatically re-set DynamicEvaluationTimeout to 6 at the
> > end of the function - that works. What does NOT work, however, is to
> > set it to 10000 at the beginning of the function. (Actually, it does
> > work, but it does not take effect yet for the currently evaluating
> > Dynamic[] within which it was set to 10000.)
> >
> > So, the question is: how do I avoid the timeout in this case, without
> > generally increasing the timeout time?
> >
> > thomas
> >
> > p.s. A very easy work-around is to call my function with the help of a
> > button, instead of using an action menu. This avoids "Dynamic" and the
> > problem doesn't even show up. Nevertheless, I think it should be
> > possible to do such things from within an action menu (or from within
> > other dynamic constructs)
>
>
>


  • Prev by Date: Re: Assign variables to a module
  • Next by Date: Re: memory release problem in mathematica6.0
  • Previous by thread: Dynamic Timeout
  • Next by thread: Re: Dynamic Timeout