Re: Problem using a dialog and dynamic
- To: mathgroup at smc.vnet.net
- Subject: [mg97838] Re: Problem using a dialog and dynamic
- From: dreiss at scientificarts.com
- Date: Mon, 23 Mar 2009 04:04:10 -0500 (EST)
- References: <gq54sh$7s5$1@smc.vnet.net>
Hi there, This is a behavior that I have encountered many time, and then keep on forgetting the fix for it and puzzle over it when I reencounter it. Then I remember the answer again and reenter my own personal Do loop of remember-forget-repeat... The answer is that, for programs such as this the Dynamic timeout comes into play. But there is a simple fix and this is to use Method->"Queued" for the button (the default is Method->"Preemptive") Best regards, David http://scientificarts.com/worklife http://scientificarts.com/mathematicatools On Mar 22, 6:45 am, "Paul Ellsmore" <paul.ellsm... at nanion.co.uk> wrote: > Hi, > > The following code should show a button > > and a text field. When I click the button, i should get > > a system dialog allowing me to select a folder, and the > > folder's file and pathname should then be displayed in > > the text field. > > Hi, > > The following code should show a button and a text field. When I click th= e > button, i should get a system dialog allowing me to select a folder, and = the > folder's file and pathname should then be displayed in the text field. > > Panel[Grid[{{Button["Select/Change Project > Directory",sourcedir=SystemDialogInput["Directory","C:\\"]]},{Column[{"= Curr e > nt Project Directory:",InputField[Dynamic[sourcedir],String]}]}}]] > > Unfortunately, the performance is erratic! > > If I click the button, then select a folder of the C drive, say C:\first, > and click "open", the textfield display C:\first as expected. But if I th= en > click the button again, and select, say, folder off the C:\first\second a= nd > click "open", the textfield does not change, nor does it for any subseque= nt > clicks. However, if I select the desktop, it works as expected, and if I > select the C: drive again it also works. > > To summarise, if i want to change the folder selection, I have to select = the > C: drive once, then click again and select the subfolder I want, and if I > want to change the subfolder, I have to select the c: drive again, before= I > can select the new subfolder. > > Is this a bug, or am I doing something stupid? I am using V7 on Windows > Vista Home Premium. > > Thanks in advance, > > Paul > > Dr. Paul A. Ellsmore > > Nanion Limited > > Oxford Centre for Innovation > > Mill Street > > Oxford > > United Kingdom > > OX2 0JX > > Tel: +44 (0) 1865 811175 > > Fax: +44 (0) 1865 248594