Tag Info

Hot answers tagged

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] <> ...


11

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:


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

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.


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

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 :)


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"], ...


2

Another way to get around the fact that the kernel will block until DialogReturn is evaluated is to use Method -> "Preemptive": DialogInput[{TextCell["Choose your folder:"], InputField[Dynamic[x]], FileNameSetter[Dynamic[x], "Directory", Method -> "Preemptive"], DefaultButton[DialogReturn[x]]}]


2

Mathematica "freezes" until you press the dialog return. This is by design for DialogInput as far as I know. So instead use CreateDialog CreateDialog[{TextCell["Choose your folder:"], InputField[Dynamic[x]], FileNameSetter[Dynamic[x], "Directory"], DefaultButton[]}]


1

Don't have time to do this better now but here is an example how you can create your own dialog without dialog: DynamicModule[{x = {0, 0}, y = {0.5, 0.5}, z = {-.5, 0.5}, panel, l = 1, point, choice, labels}, Overlay[{ Dynamic@ Graphics[{AbsolutePointSize@12, point@x, point@y, point@z}, Frame -> ...


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