Hot answers tagged dialog-window
11
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] <> ...
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 ...
7
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 ...
7
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 :)
7
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.
6
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], ...
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
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 ...
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
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 ...
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"],
...
1
On Mac it always comes up as "All Files". I presume the "All Files"/"PDF" distinction is what you are noting although it looks like the home directory on Windows differs as well whereas on Mac it does not.
This is a grab from Player Pro:
The default representation as `".PDF...." is a bug I believe (had a back and forth with tech support about this sort ...
1
I don't know about Player Pro but a CDF generally has some restrictions as outlined in the documentation center:
Interactivity in .cdf Files
Almost all of the functions available in Mathematica can be used to build applications for CDF Player, but there are a few programming restrictions to keep in mind.
All interactive content must be generated with the ...
1
It is not clear to me from your question how you want to use this operation. If you create a Button with this code you should be able to click the button to print a selected block of code.
Button["Print Selection",
FrontEndTokenExecute @ "PrintSelectionDialog"
]
If you want to perform this operation programmatically you need to control the selection ...
1
A workaround might be if your looking for one colour for the whole window including the plot is to call the background colour at another place?
CreateDialog[
DocumentNotebook[
Column@{Slider@Dynamic@n,
Dynamic@Plot[Sin@x, {x, 0, n \[Pi]}, Frame -> True, Axes -> False,
ImagePadding -> 30, ImageSize -> 300]},
Background -> ...
Only top voted, non community-wiki answers of a minimum length are eligible

