Hot answers tagged

14

Edit > Preferences > "Advanced" tab > Open Option Inspector In the Option Inspector's sidebar, drill down to Notebook Options > Window Properties. For the WindowElements option, uncheck "StatusArea" and "MagnificationPopUp". Here's what your Option Inspector should look like:


12

Does the following work as needed? CreateDialog[ TabView[ {"General" -> Column[{Row[{"Project Name:", InputField[Dynamic[project]]}], Row[{"Number Of Wells:", InputField[Dynamic[num]], Button["Set", DialogReturn[num]]}]}], "Row Selection" -> Dynamic@Column[ Table[Row[{"Well " <> ToString[i] <> ...


9

This is all you need: Button["Press Me", Print[ChoiceDialog["OK or Cancel?"]], Method -> "Queued"] Without the queued method the choice dialog clashes with the button, which is in preemptive mode by default, meaning it tries to run as the foremost process. It also works fine in a dynamic module.


9

Not 100% solution, but this may work. Define: dialog := CreateDialog[{TextCell["Click OK to close"], DefaultButton[]}, Modal -> True, NotebookEventActions -> {"WindowClose" :> dialog}] Then call: dialog At least, it reappears :)


8

SystemDialogInput["FileSave"] will do this for you. Something like fileName = SystemDialogInput["FileSave"] If[fileName != $Canceled, Export[fileName, myData]] should do the whole trick. The fire extension determines the type of export (if MMA knows it and supports it). Preselecting a directory path and filtering allowable file extensions can be done as ...


8

The behaviour is indeed inconsistent: CreateDialog uses the option WindowSize -> All, where All (god knows why) causes the unexpected behaviour with dynamic content. See resolution of the problem at the end of the post. The following even more simple example clearly shows that something fishy is going on: only path2 can be set via the second button but ...


8

What really makes Dialog a model dialog is: WindowFrame -> "ModalDialog" (*or*) WindowFrame -> "MovableModalDialog" So be careful when changing WindowFrame with the expectation that your dialog will remain modal. Funny proof is that the following: CreateDialog[DefaultButton[], WindowFrame -> "ModalDialog", Modal -> False] is a modal ...


7

Here is one solution:- CreateWindow[DialogNotebook[{TextCell["Number of Stations: "], PopupMenu[Dynamic[ns, ( ns = #; (* set default values *) Function[n, (x[n] = 0)] /@ Range[ns]; col = Column[InputField[Dynamic[x[#]]] & /@ Range[ns]]) &], Range[2, 8]], TextCell["Sound Frequency (kHz): "], Dynamic[col], ...


7

To make it work, use Button["run file 1", NotebookEvaluate["/../file1.nb"], Method->"Queued"]


7

it is not etirely clear for what you need that, but I think the best way to store data within a Notebook so that it is available in the next session is the TaggingRules option. This is how you could store data for a there: CurrentValue[EvaluationNotebook[],{TaggingRules,"dataset-name"}] = data; And this is how you can read it: data = ...


5

The following works for me with Mathematica 8.0.4 DynamicModule[{switch = 1}, CreateDialog[ globalvar = DocumentNotebook@TextCell@Dynamic@Switch[switch, 1, "A", 2, "B"], WindowSize -> {200, 100}]]; However making the variable local to the DynamicModule does not work: DynamicModule[{switch = 1, localvar}, CreateDialog[ localvar = ...


5

As stated in the Create a Computable Document Format file HowTo (section "Interactivity in .cdf Files"): Dialog windows are not supported Other links: http://www.wolfram.com/cdf/faq/ http://www.wolfram.com/player-pro/how-player-pro-compares.html


5

Try this: SystemDialogInput["FileOpen", {"Data", {"Data" -> {"*.data", "*.dat"}}}] The doc page for SystemDialogInput describes under "More Information" how to create new file types by listing the patterns they match.


5

Since all windows in Mathematica are basically Notebook objects (notebook windows, palettes, dialog windows, etc.), one can use the more general CreateWindow[DialogNotebook[...]] approach, which is a bit more customizable than CreateDialog. The other option is to use the more specific Dialog function, but it is rather limited when it comes to designing a ...


5

Add False as a second argument to FrontEndToken for "Revert": FrontEndExecute[FrontEndToken["Revert", False]]


5

Using DialogInput instead of CreateDialog DialogInput[ Grid[{{"Year:", InputField[Dynamic[yyyy], Number]}, {"Month:", InputField[Dynamic[mm], Number]}, {"Day:", InputField[Dynamic[dd], Number]}, {CancelButton[], DefaultButton[ DialogReturn[{Year = yyyy, Month = mm, day = dd}]]}}, Spacings -> {1, Automatic}, Alignment -> Left]] ...


4

I don't think this is a difference between Mathematica and the Player Pro but between Mathematica 8 and 9. For me Mathematica 8 brings up the same dialog as Player Pro 8, while Mathematica 9 brings up something slightly different (my interpretation is that WRI has improved the automatic behavior, I'm not sure whether I'd call the old behavior to be wrong or ...


4

In the comments celtschk suggested Button[..., Method -> "Queued"] and Christina confirmed it as a solution.


4

Updated: It seems like this bug has been ironed out in version 9. as it does not cause a crash anymore. Instead of comments, let's gather here the information we have: Crash happens on Mathematica 8.0.0.0 through 8.0.4, seemingly on all OS (reported confirmed on: WinXP/32, Mac OS 64-bit, Ubuntu 64bit, Win7/32). Mathematica 7 doesn't crash, at least on ...


4

As Rojo has pointed out, Method -> "Queued" can be used for the Button to wait for the dialog to appear, be evaluated, and return. I assume you want to use the value of name in some outer computation, so I forwarded it via a DialogReturn and therefore it is made global (while name inside DialogInput is local). Note that DialogReturn is the standard way to ...


4

My approach to this task would be to create new Input Cells within the notebook, that have the same structure as newly typed in symbol definition. createNewSymbol[] := Module[{importFileName = SystemDialogInput["FileOpen", ".txt"]}, With[{importedData = If[StringQ@importFileName, Import[importFileName, "Table"]], symName = ...


4

Update: It appears that the Magnification option is available and can be used to scale whatever collection of objects is placed in the window so that everything fits. (This, of course, doesn't mean that everything will be readable.) DialogInput[Table[InputField[i], {i, 50}], WindowSize -> All, Magnification -> 0.35] End-of-update. The issue is ...


4

DynamicModule[{counters, oldcounters}, Button["Set Counters", oldcounters = CurrentValue[InputNotebook[], {CounterAssignments}][[All, 2]]; counters = DialogInput[{x = 0, y = 0}, Column[{ "SetCounters:", Row[{"StaticChapter ", InputField[Dynamic[x,(x = Round[#]) &], Number]}], Row[{"StaticSection ", InputField[Dynamic[y,(y ...


4

There is a straightforward way to set CellMargins to be zero: DialogInput[ DialogNotebook[{ExpressionCell[Pane[RandomImage[], ImageMargins -> 8], CellMargins -> 0]}]] Instead of ImageMargins we can rely on CellFrameMargins: DialogInput[ DialogNotebook[{ExpressionCell[RandomImage[], CellMargins -> 0, CellFrameMargins -> 8, ...


3

Just replacing the DynamicModule in the right place may help... CreateDialog[DynamicModule[{switch = 2}, DocumentNotebook@TextCell@Switch[switch, 1, "A", 2, "B"]], WindowSize -> {200, 100}]; or (see the comments below) DynamicModule[{switch = True}, CreateDialog[TextCell@{Dynamic@Switch[switch, True, "A", False, "B"], ...


3

You need the values of the options "WindowTitle" and "ModifiedInMemory". These can be obtained using the function NotebookInformation. For notebooks that have not been modified since the last save the value of the option "ModifiedInMemory" is True. So, you can do: {"WindowTitle", "ModifiedInMemory"} /. (NotebookInformation /@ Notebooks[]) to get all the ...


3

If what you are looking for is the ability to halt access to the notebook (or the Mathematica front end in general), then you want to set Modal->True in the MessageDialog options. MessageDialog["Click to Continue", Modal->True] As mentioned in the comments, Model does not appear to be a valid option for MessageDialog; however, it works. It does ...


3

Dialogs are notebooks with different from regular options settings, so you can export save them as you want: (that is the case with palettes too) Export[ FileNameJoin[{$TemporaryDirectory, "myDialog.nb"}], CreateDialog[ Column[{ InputField[Dynamic[a], Number, FieldHint -> "enter a"], InputField[Dynamic[b], Number, FieldHint ...


3

Perhaps: f[aa_, oo_, pp_] := CreateDialog[ Column[{Manipulate[ Plot[(aa = amp) Sin[(oo = omega) t - (pp = phi)], {t, 0, 10}], {amp, 0, 1}, {omega, 1, 10}, {phi, 0, 2 Pi}], DefaultButton["Close", DialogReturn[]]}], Modal -> True]; Dynamic[{a, o, p}] f[Unevaluated@a, Unevaluated@o, Unevaluated@p]


3

This seems to work. picture = Rasterize[Table[i + j, {i, 100}, {j, 100}] // MatrixForm]; DialogInput[ {Manipulate[Pane[picture, Scrollbars -> True, ImageSize -> Large], {a}, {a}, {a}, {a}, {a}], DefaultButton@DialogReturn[]}, WindowSize -> All] But it has scrollbars



Only top voted, non community-wiki answers of a minimum length are eligible