Hot answers tagged interface
20
Date-picker implementation in Mathematica
The following is my implementation of a simple date-picker. The current date is highlighted in LightBlue and the weekends are highlighted in LightGreen. The selected date is always highlighted in LightRed (the default selection is the current date).
You can tap into this calendar by using the Dynamic values for ...
17
If you want readline-like behavior you can of course use a readline wrapper. This works on all operating systems. On Ubuntu Linux (and other distributions I'm sure too) it can be installed easily through the package management. On Max OSX this can be installed using for instance MacPorts and I'm sure, there is an easy option on Windows too. Anyway, on all ...
12
This code is not generalized. It has been written for a specific problem but you can take it and should be able to make it a more general function -- add flexibility (e.g. add grid options) or tailor it to your needs.
ClearAll[frozenPaneGrid];
Options[frozenPaneGrid] = {"RowLabelSort" -> False};
frozenPaneGrid[tl_, tr_, bl_, br_, OptionsPattern[]] :=
...
11
There's also a way to do it programmatically with LineBreakWithin
SetOptions[$FrontEnd, LineBreakWithin -> False]
Recover the original with:
SetOptions[$FrontEnd, LineBreakWithin -> Automatic]
Warning:
This function has not been fully integrated into the long-term Mathematica system, and is subject to change.
10
Here is the summary:
There is no shortcut (you can suggest here)
Quick close/open labeled minimize below
Disable from Top Menu >> Edit >> Preferences...
9
The answer is that yes, you can affect the appearance of components of a control but the problem in this case is that your list of appearances
appearances = {"DialogBox", "Palette", "FramedPalette", "Frameless"};
are only valid Button appearances and that is why they have no effect of ButtonBar or TabView. When you use valid appearances it works fine:
...
9
I don't think the answer is related to choosing $OperatingSystem or SystemInformation as in Mr.Wizard's and F'x's answers (although both are cleaner than using $Version). I'm guessing you created your file on your PC and then opened it in your Mac. Tooltip then shows you the cached result from your PC. To make the tooltip refresh on your other machines, ...
9
I found the solution. Mathematica is set up to use this font. The tip-off is in the UnicodeFontMapping.tr file referenced in the question. The header reads:
@@resource UnicodeFontMapping
Mathematica: Times Automatic
Mathematica: (Times Courier) Automatic
Mathematica: (Mathematica1 Mathematica1Mono) Automatic
Mathematica: (Mathematica2 Mathematica2Mono) ...
9
This is because you are using = (the assignment operator) in the condition (not the body) of While. It is a typical beginner mistake to use = where == is meant, so Mathematica warns about this.
Since you also use several ; in the condition, it gets a little confused and only highlights one of the = signs, not all of them.
8
If you're on Windows: which command line interface are you talking about?
The "math.exe" program is a console mode (i.e. "DOS prompt") interface to the Mathematica kernel. If you use that, you have access to the standard Windows console command-line editing; it is automatically provided by the OS to all console mode programs. You can use the arrow keys to ...
8
I would say JLink is one of the fastest ways to do this. Just use the Runtime to start a process executing your command and collect the exit code too:
<< JLink`
RunThroughWithExitCode[cmd_String] :=
JavaBlock[Module[{ireader, istream, runtime, process, reader},
LoadJavaClass["java.lang.Runtime"];
runtime = Runtime`getRuntime[];
process = ...
8
I don't know whether I interpret your question correctly but have you checked Preferences->Appearance?
There you see what the colors of the syntax highlighter mean:
7
Perhaps the simplest way is to introduce a global variable storing the Manipulate variables:
Manipulate[
global = {A, f, p};
Plot[A*Sin[f*t + p], {t, 0, 2 Pi},
PlotRange -> {{0, 2 Pi}, {-1, 1}}],
{A, 0, 1}, {f, 1, 10}, {p, 0, 2 Pi}]
From now on, we can query global in a different cell any time. If wrapped into Dynamic, it will be updated as the ...
7
If you just want A, f, and p dynamically displayed all the time and printed when desired then:
Manipulate[
Column[{
Row[{Button["print",
CellPrint[
TextCell[Grid[{{"A =", A}, {"f =", f}, {"p =", p}}], "Text",
ShowStringCharacters -> False]]], {A, f, p}}],
Plot[A*Sin[f*t + p], {t, 0, 2 Pi},
PlotRange -> {{0, 2 Pi}, ...
7
You can always create your own custom controls. This is a lot of work, but it also gives you unlimited flexibility. You can even create completely new kinds of control.
Scroll down to the last section here to see an example.
If you're aiming for a custom TabView-like control, I'd start with PaneSelector.
Here's a primitive example (just a start, not ...
6
How to format
Using AccountingForm :
I show first the output of one function for your number
n = 2.60152*10^-8 (*your number *)
padIt[n, {15, 14}]
(* +0.00000002601519 *)
the first parameter is the number to format, then there is a list of 2 numbers. The first is the total number of digits you want in the field. The second number is how many digits ...
6
Some generic examples:
DynamicModule[{var = 3, var2 = 1, var3 = "hello"},
Column[{
PopupMenu[
Dynamic[var], {1 -> "Display Popup", 2 -> "Display Input field",
3 -> "None"}],
PaneSelector[{
1 -> PopupMenu[Dynamic[var2], Range[4]],
2 -> InputField[Dynamic[var3]],
3 -> Spacer[0]
}, Dynamic[var]]
}]
...
6
The list of recently opened notebooks (as shown in File > Open Recent) is saved in the NotebooksMenu option for $FrontEnd, arranged by ascending absolute time (i.e., most recent is last). So the most recent notebook can be opened with:
Last[NotebooksMenu /. Options@$FrontEnd] /.
HoldPattern[_ -> {file_, ___}] :> NotebookOpen@file
Some ...
5
Does this answer your question?
CreateDialog[SystemInformation[],
WindowTitle -> "Mathematica System Information"]
Another example
man = Manipulate[Plot[#[k t], {t, 0, 10}], {k, 0.1, 10}] & /@ {Cos,Sin, Exp} // TabView
Now you can put it in a dialog
CreateDialog[man, WindowTitle -> "My manipulate"]
5
How about using $OperatingSystem?
Typical values for $OperatingSystem are "Windows", "MacOSX" and "Unix".
$OperatingSystem
"Windows"
5
Here is one that should work in version 6 and later. The full code is at bottom.
Here is what it looks like:
{dateSetter[Dynamic[d]],Dynamic[d]}
I did not incorporate the year here, but you could put it in a Tooltip or add it to the button's graphic.
And when you click on the button you get
Incorporate this into a Manipulate using ...
5
As surmised by @Sjoerd in the question's comments, Manipulate combines all locators into a single LocatorPaneBox. We can see this if we inspect the boxes generated by the Manipulate expression:
PaneBox[PanelBox[DynamicWrapperBox[PaneSelectorBox[{True->GridBox[{{
...
LocatorPaneBox[
Dynamic[{$CellContext`point1$$,$CellContext`point2$$}],
...
...
5
You could use this
NumberForm[2.601519253*10^-8, {16, 16},
ExponentFunction -> (If[-10 < # < 10, Null, #] &)]
(*
0.0000000260151925
*)
Export into CSV format could be done as follows:
Define a function
numFormat[y_] :=
ToString@NumberForm[y, {16, 16},
ExponentFunction -> (If[-10 < # < 10, Null, #] &)]
create a few ...
4
If you want something that displays in abbreviated from, you can do the following:
Type Quantity[number, "unitstring"], for example Quantity[5, "m"].
Select that expression (pressing Ctrl. twice will do that if you haven't moved the cursor).
Perform Evaluate In Place (CtrlShiftEnter on Windows and Linux, CmdEnter on OS X). This will give you something ...
4
It looks like ArrayPlot is a good approach. I found it a bit faster (especially for a larger splash width) to create the splash up front as a packed array and use RotateRight to move it around.
I have also switched off SynchronousUpdating for the graphics, so IC can update more smoothly.
L=100;
...
4
This functionality is simply not available in the Front End. I doubt that as a user it's possible to implement practical and usable code folding in the front end. WRI would have to add it.
Some text editors do have this functionality though:
The Wolfram Workbench can fold functions, but not parts of functions.
Sublime Text supports indent based ...
3
The way to get those characters is to type their long name in the form specified in the right hand column of that table. I don't know what it's supposed to look like, but to me they look just like a smaller variant of the latin alphabet.
In[39]:= ToCharacterCode["\[KlingonA]\[KlingonB]\[KlingonCH]\
...
3
I interpret this question differently: you want an Input cell that does not reflow text such than manual line breaks and indentation are preserved.
This is the behavior of the built-in Code cell style, but that by default comes with baggage such as making the cell an Initialization Cell and a gray background. It also turns off all auto-spacing, meaning ...
3
If you mean InputAutoReplacements in text cells you can switch these off in the options inspector.
But this means doing it every time you want to switch it off best to add it to your stylesheet programmatically:
SetOptions[EvaluationNotebook[],
StyleDefinitions ->
Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]],
...
3
I was just working along the lines of @Rojo's comment:
DynamicModule[{i = 0, state = False},
Dynamic[If[ControllerState["Button 1"],
If[state, i = i + 1; state = False], If[! state, state = True]]; i]
]
Sometimes it appears that the mouse action is intercepted by Mathematica. You may find that unnacceptable.
Only top voted, non community-wiki answers of a minimum length are eligible


