MathGroup Archive 2007

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

Search the Archive

Re: StringInput Question

  • To: mathgroup at
  • Subject: [mg83512] Re: StringInput Question
  • From: Szabolcs Horvát <szhorvat at>
  • Date: Wed, 21 Nov 2007 06:01:54 -0500 (EST)
  • References: <fi0p1j$67m$>

Joe Sneed wrote:
> The following is is a test for a button that prompts for inputting a 
> string to be written to a notebook.
> *Cell[BoxData[
> ButtonBox["TEST",
> Active->True,
> BaseStyle->"Paste",
> ButtonFunction:>
> FrontEndExecute[{
> content =
> InputString["New Tag"];
> nb = SelectedNotebook[];
> NotebookWrite[nb,
> Cell[content, "Text"]];
> Clear[content];
> Clear[nb]}],
> Evaluator->
> "Local"]], "Text",
> FontFamily->"Arial",*
> *FontWeight->"Bold"]*
> Run in V6.01, when the dialog box for StringInput is closed without 
> input, the string
> $Canceled
> is written to the selected notebook.
> The desired behavior (which I think occurred in V5.01, though I have no 
> easy way to check now) is that when the dialog box for StringInput is 
> closed without input, nothing is written. How can this be obtained with 
> V6.01?

In Mathematica 5.2 there was only an "OK" button.  When the user pressed 
this button, without typing anything, and empty string was returned.

In Mathematica 6 there is both an "OK" and a "Cancel" button.  The "OK" 
button returns the empty string, the cancel button returns $Cancelled. 
  So if you would like to input an empty string, just press OK without 
typing anything.


  • Prev by Date: Joining InterpolatingFunctions into Piecewise - doman?
  • Next by Date: Re: Importing and manipulating text files
  • Previous by thread: StringInput Question
  • Next by thread: Re: StringInput Question