MathGroup Archive 2009

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

Search the Archive

Re: Re: Two Notebooks Open at the Same Time


By using DialogInput the assignment can be done in the main notebook:

ret=DialogInput[{TextCell["Enter a name: "],
  InputField[Dynamic[nm],String],
  DefaultButton[DialogReturn[nm]]}]

Or you can pass the proper context to the dialog notebook:

CreateDialog[{TextCell["Enter a name: "],
  InputField[Dynamic[nm],String],
  DefaultButton[DialogReturn[ret=nm]]},
    CellContext->Context[]]

Fred Simons
Eindhoven University of Technology

Januk wrote:
> One needs to be careful using the "Unique to This Notebook" context
> setting.  It causes some strange behaviour when using dialog boxes.
> The following example from the CreateDialog help page (ref/
> CreateDialog) does not work as described when using the "Unique to
> This Notebook" setting.  Note that the example does work as expected
> when running the notebook in the Global` context:
>
> In[1] := CreateDialog[{TextCell["Enter a name: "],
>    InputField[Dynamic[nm], String],
>    DefaultButton[DialogReturn[ret = nm]]}];
> In[2] := ret
>
> Out[2] = ret
>
> There appears to be a context issue, though running Context[] does not
> reveal what the issue is:
>
> In[3] := Context[]
> In[4] := CreateDialog[{Context[]}];
> Out[3] = "Notebook$$13`"
>
> This behaviour appears in version 6 and 7.0 for Microsoft Windows (32-
> bit).
>
> Januk
>
>
> On Mar 15, 6:28 am, Brett Champion <bre... at wolfram.com> wrote:
>   
>> [I'm NOT an expert on this stuff, but...]
>>
>> "Evaluation" > "Notebook's Default Context" is probably useful,  
>> especially the "Unique to This Notebook" setting.
>>
>> Brett Champion
>>     
>
>
>   



  • Prev by Date: Re: formatted table output to ascii file
  • Next by Date: Bug in LaplaceTransform?
  • Previous by thread: Re: Two Notebooks Open at the Same Time
  • Next by thread: Re: Two Notebooks Open at the Same Time