Tag Info

Hot answers tagged

9

It turned out that the MathematicaClosingDialog.nb is a nice example for a graphical user interface that solely uses the FrontEnd MathKernel. On the downside, one has to deal with low-level code. First I made a copy of the original MathematicaClosingDialog.nb, renamed it as MathematicaClosingDialog_Default.nb, and then imported it into a notebook: nb = ...


7

Mathematica does it internally by using BoxForm`ArrangeSummaryBox, which is quite straightforward to figure out: MakeBoxes[obj_MyObject, fmt_] ^:= Module[{o = List @@ obj, shown, hidden, icon = Graphics[{Blue, Circle[]}, ImageSize -> 70]}, shown = {{ BoxForm`MakeSummaryItem[{"Name: ", "Name" /. o /. "Name" -> Missing[]}, fmt], ...


7

If you want full flexibility you should try EventHandler and graphics primitives. If you can decipher the following example you will get the idea: color = Black; positions = Position[DiskMatrix[5], 1]; disks = {color, Disk[#, 0.4]} & /@ positions; eventHandler[item : {c_, obj_: Disk[p_, _]}] := {c, EventHandler[obj, "MouseClicked" :> (disks = ...


7

Here's a walkaround: Manipulate[ x, Row @ List @ EventHandler[ Checkbox[Dynamic[x]], {"MouseDown" :> (x = True), "MouseUp" :> (x = False)}] ]


6

TabView[KnotData[#, "BraidWordNotation"] -> Labeled[Graphics[KnotData[#, "BraidDiagramData"]], Style[KnotData[#, "AlexanderBriggsNotation"], Large], {{Right, Bottom}}] & /@ Take[KnotData[All], {2, 6}], ControlPlacement -> Left, Alignment -> Center]


6

I guess all the important information can be found in the tutorial, specifically in the subsection Access to the Java Object Layer There, you see that you can easily extract the class that is used for widgets << GUIKit` ref = GUIRun[Widget["Label", {"text" -> "Stay afloat!"}]] First[ref] (* « JavaObject[com.wolfram.guikit.swing.GUIKitJFrame]» ...


5

Step 1 As a very quick example of how one might start, with the limitation of only one "type" available: convert[Grid[m_?MatrixQ, ___]] := m[[All, All, 1]] Defer[convert]@Grid[ConstantArray[RadioButton[], {4, 7}], Spacings -> {0.2, 0}] Which outputs: You then make a selection: And evaluate it (the output), yielding: {{False, False, False, ...


4

Something like this? This seems to be controlled by WindowElements nb = CreateDocument[ TextCell[StringJoin[Table["abcd ", {50}]], "Text", PageWidth -> 1200], WindowElements -> {}];


4

Dynamic is sometimes too aggressive for some purposes. You need to make sure Dynamic updates only when you are ready for new results. Besides, to ensure that Dynamic will have enough time to process your request it is sometimes a good idea to use SynchronousUpdating option. In the solotuion below you will see that instead of calculating the menu options ...


4

Just to provide a full answer (and thanks Kuba's answer) in case someone wants to screencast while using Mathematica and byzanz (Gnome only): recordGif::Usage = "Record Mathematica animations; Syntax: recordGif[time,delay]"; recordGif[time_, delay_] := DynamicModule[{pathToGif, pathToSh, toGIF, posGIF}, Panel@Column[{ Button["Run", Print["Starting ...


3

Edit I've updated my answer entirely since the updated question First Issue As detailed in the documentation for Initialization, this expression is not evaluated until after the content of the DynamicModule has been evaluated and not until "the construct is first displayed". This requires that any Initialization variable must be wrapped in Dynamic to be ...


3

Not sure about general concept but maybe you can use this minimal example and extend/adjust to your needs: Grid[{{ ListPicker[ Dynamic[selectList, (selectList = #; re = Select[selectList, #[[3]] === "Yes" &]) &], dataImport] , Dynamic @ If[TrueQ[re === {}], "", {"Include ...


3

Note the second paragraph you've cited: If the dialog contains no DefaultButton or CancelButton, pressing Enter or Esc will close the dialog without taking any other action. It turns out the inverse is true as well; you can make the dialog notebook contain an invisible DefaultButton that doesn't do anything. Here's an example with Overlay: ...


2

Using the logManipulator from my answer to Logarithmic slider, you can also achieve your objective via Manipulate[ f[x, y], {x, 10.^-10, 10^-1, 10, logManipulator[##] &}, {y, 0.01, 1, 0.01}] Code for logManipulator: ClearAll[logManipulator]; With[{smallerRule = {Large -> Medium, Medium -> Small, Small -> Tiny}}, ...


2

Not sure if it is what you are after: action[dog_] := Print@StringForm["take dog no.`` for a walk", dog]; RadioButtonBar[Dynamic[dog, (dog = #; action[dog]) &], {1, 2, 3}]


2

I can confirm that this occurs (using the above code and clicking "panel format…") using Mathematica v.10.0.0 on OS X 10.9.4 (64-bit). I can't provide any further help on the MWE for this, as I'm still learning to use MMA as a coding language, rather than a fancy CAS. I've uploaded a copy of the OS X crash log here. EDIT: As Mr. Wizard observed, this ...


2

AFAIK there is no ready to use functionality for this in Mathematica available at this time. I see two possibilities to still get what you want: either use NETLink or JLink to write a GUI containing a treeview supplied by either .NET or e.g. Swing. That will mean your GUI will have to live in an extra window, will need some deeper understanding of the ...


2

If it were a venn diagram, clicked would be a subset of dragged (at least in the mind of whoever implemented this). You can reproduce what (I think) you want by adding a null event for "clicked": EventHandler[ Framed[1], {"MouseClicked" :> Null, "MouseDragged" :> (Print@RandomReal[])}] ---EDIT--- Or, for that matter, as per your comment, it is ...


2

Perhaps there is a more convenient way of doing this than resorting to esoteric boxes. The following uses the code you posted to define a function: summaryDisplay = DynamicModule[{open = True, sqrplus = RawBoxes@FrontEndResource["FEBitmaps", "SquarePlusIconMedium"], sqrminus = RawBoxes@FrontEndResource["FEBitmaps", "SquareMinusIconMedium"], ...


2

Quick fix is to use Pane[#, ImageMargins -> {{0, 10}, {5, 5}}] & on tabs contents. Not convenient but working. Probably also OS dependent solution... To not copy this I'm using a function which can be used directly on TabView: tabViewFix1 = Function[tabView, MapAt[ Pane[#, ImageMargins -> {{0, 10}, {5, 5}}] &, ...


2

Rough approach: Tooltip resources are stored in FileNameJoin[{ $InstallationDirectory, "SystemFiles", "FrontEnd", "TextResources", "ToolTip.tr"}] In order to not mess with installation directory you can copy this file to $UserBaseDirectory/SystemFiles... and replace labels you want. For example: @@resource ToolTipCut Cut (replace this line ...


2

Here are some relevant stack exchange posts: Showing "updating..." message while Manipulate is re-evaluating Show Progressbar after pressing a button Evaluation indicator for a notebook Igor


2

After István Zachar's points, I was investigating Input definitions to learn more. It seams that 2 years later WRI changed approach from SelectionMove based to more automatic BoxReferenceFind. usage So what we only have to do is to set BoxID option for fields of interest and find those references when we want, with: MathLink`CallFrontEnd[ ...


1

You can achieve almost the same thing by saving coordinates. Place an image in Mathematica, click on it, and choose the "coordinates tool" form the little popup menu. Click on as many points as you want (say the upper left and lower right of a bounding box, if that's what you want). When done, choose "copy coordinates". Then paste them into a list.


1

As Fred has suggested, Initialization is the way to go, and here is a minimal example: DynamicModule[{answer, answers = Range@10, order}, Column[{ "Pick 1:", Dynamic[RadioButtonBar[Dynamic@answer, answers[[order]]], TrackedSymbols :> {order}] }] , Initialization :> ( order = RandomSample@Range@Length@answers; ), ...


1

My solution uses SetterBar with the items framed. {SetterBar[Dynamic[x], {"Play" -> Framed[Rotate["\[FilledUpTriangle]", -\[Pi]/2]], "Stop" -> Framed@"\[FilledSquare]"}, BaseStyle -> {FontSize -> 20}], Dynamic@Switch[x, "Play", Style["Play", Green], "Stop", Style["Stop", Red]]} It is pretty close. I'm certain you can tweak the font ...


1

Turned out it was easy to replicate the buttons from Play: $playView=ToExpression@GraphicsBox[ TagBox[{ {GrayLevel[0.9], RectangleBox[{5, -158}, {29, -135}]}, {GrayLevel[0.3], PolygonBox[NCache[{{13, -153}, {13, -140}, {21, Rational[-293, 2]}, {13, -153}}, {{13, -153}, {13, -140}, {21, -146.5}, {13, -153}}]]}, ...


1

I think you are working too hard. If you just want to put a plot below your input fields, you can do it like this. asq[a_] := a*a DynamicModule[{a = 2}, Style[ Panel[Dynamic @ Column[{ Grid[{ {Style["Input number", Blue], InputField[Dynamic[a], Number]}, {Style["Square of number", Red], ...


1

I reported a problem with Opener and Appearance option, this is the reply: [CASE:2678632] Feedback [...] There is an 'Appearance' issue on the Windows platform and it has been reported already. [...] So I believe it is a subject to change. As a temp. replacement: opF = Opener@False~Rasterize~(ImageSize -> 12); opT = ...


1

Ok, I got it. I can't find simplier method, but this one actually works for me. I don't create variables for every single TextField. While using BitAnd[] for example I'm doing it this way: SetPropertyValue[{"siec1", "text"}, ToString[BitAnd[ToExpression[PropertyValue[{"O1", "text"}]], ...



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