Re: StringInput Question
- To: mathgroup at smc.vnet.net
- Subject: [mg83512] Re: StringInput Question
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Wed, 21 Nov 2007 06:01:54 -0500 (EST)
- References: <fi0p1j$67m$1@smc.vnet.net>
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.
--
Szabolcs