Mathematica 9 is now available
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: [mg83572] Re: [mg83480] Dynamic Timeout
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Fri, 23 Nov 2007 05:32:52 -0500 (EST)
  • Reply-to: jfultz at wolfram.com

A better solution (i.e. one that never touches the global value of 
DynamicEvaluationTimeout) than EventHandler[] would be to set 
DynamicEvaluationTimeout using Style.

E.g.,

Style[ActionMenu[...], DynamicEvaluationTimeout->1000]

Mea culpa.  I plead temporary insanity while trying to get home for 
Thanksgiving.  Thanks to Carl Woll for the prod about this.

Sincerely,
 
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.


On Wed, 21 Nov 2007 19:36:59 -0600, John Fultz 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: Dynamic Timeout
  • Next by Date: Re: Discrepancy between Integrate and NIntegrate
  • Previous by thread: Re: Dynamic Timeout
  • Next by thread: Re: Dynamic Timeout