Re: Dynamic Timeout
- To: mathgroup at smc.vnet.net
- Subject: [mg83586] Re: Dynamic Timeout
- From: m.r at inbox.ru
- Date: Sat, 24 Nov 2007 04:04:55 -0500 (EST)
- References: <fi0pb5$6b6$1@smc.vnet.net>
On Nov 21, 2:13 am, thomas <thomas.mue... at gmail.com> 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) You can set DynamicEvaluationTimeout -> 10000. as an option for a single cell: Style[ActionMenu[ "menu", {"file" :> Print[SystemDialogInput["FileOpen"]]}], DynamicEvaluationTimeout -> 10000.] SetOptions[EvaluationNotebook[], DockedCells -> Cell[ BoxData@ ToBoxes@ ActionMenu["menu", {"file" :> (tmp = SystemDialogInput["FileOpen"])}], DynamicEvaluationTimeout -> 10000.]] Maxim Rytin m.r at inbox.ru