Tag Info

Hot answers tagged

7

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

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]


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


5

You can start from this, the answer is checked by Button or by pressing Enter. This may look like a lot of code. Well if your app is shor you do not need to play with Initialization and storing different elements in different variables but this is an approach that I'm using for more complicated cases, the code is readable and easy to extend. With[{ optG = ...


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


4

It is because ResetButton refers to Manipulate`s initial state while pt is outer DynamicModule variable here. You can scope variables in Manipulate with a cool trick, which I've learned here: {{pt, {0.5, 0.5}}, None} Manipulate[ ArcTan @@ pt, {{pt, {0.5, 0.5}}, None}, DynamicModule[{}, LocatorPane[ Dynamic[pt], ...


4

Here is a toy example: qnam[q_, a_, alt_, nr_] := DynamicModule[ {ln, funs, var, enb, layout, cusum, vis = "", perc}, ln = Length[q]; enb = Table[Unique["e"], {ln}]; Map[(#[_] := True) &, enb]; funs = Table[Unique["f"], {ln}]; var = Table[Unique["v"], {ln}]; MapThread[(#1[u_] := If[u == #2, 1, 0]) &, {funs, a}]; layout = ...


4

This Answer is based upon Kuba's comment above regarding two InputFields, so credit should go to him for the idea, this is just an implementation. However, the problem interested me because I have a similar issue to solve regarding entering units into answers, and this question and Kuba's comment made me think of a related solution to that. One can use ...


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


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

pos = {}; SetOptions[EvaluationNotebook[], NotebookEventActions :> { "MouseClicked" :> If[CurrentValue["AltKey"], AppendTo[pos, MousePosition[]]], PassEventsDown -> True}] Dynamic@MousePosition[] Dynamic@pos So, while pressing Alt you can click to store your positions.


2

I did analogous, when teaching my son to calculate. It is about addition, but is easily transformable for the multiplication. Below argue01.gif and cataround.gif are two movies that I took from a site with animated icons. They were stored in the same directory and loaded before the first evaluation of the game. If you will play the code without these movies ...


2

After some significant time browsing related questions on this site as well as trial and error, I believe that I have managed to create a solution for what I was trying to accomplish. Taking the advice from Ariel I have essentially created my own custom array of checkboxes that do not experience any major delay when one of them is clicked. I have ...


2

Quick fix is to add additional Pane Framed[ FlipView[Pane[Framed[#], 50, Alignment -> Center] & /@ {100, 1}, Alignment -> Center] , ImageSize -> {100, 150}, Alignment -> Center] But the issue is to be remembered.


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


1

I will report this to WRI, meanwhile: 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 ...


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


1

I'm still not sure about details of behaviour you are after but you can certainly build on this: Basicaly you can use the second argument of Dynamic. ClearAll[a, b, c]; a = b = c = 1; Grid[{ {"a", "b", "c"}, { InputField[ Dynamic[a, (a = #; If[# =!= Null, c = a b/2]) &]], InputField[ Dynamic[b, (b = #; If[# =!= Null, c = a b/2]) &]], ...


1

I'm sorry, I don't have time to address all issues in your code. But if you take a closer look at docs for things I'm using I'm sure you can understand what was wrong and why it works now. SetAttributes[ListPicker3, HoldFirst] ListPicker3[var_, list_] := DynamicModule[{temp = var, keycap}, DynamicWrapper[ ListPicker[Dynamic[temp], list], ...


1


1

f[x_, y_] = x*y; Manipulate[ f[x, y] // ScientificForm, {{x, 10.^-6}, 10.^Range[-1, -10, -1]}, {{y, .5}, 0.01, 1, 0.01, Appearance -> "Labeled"}]


1

This is not an answer. It is a suggestion about how you might simplify your code. I suggest that the simpler expression Column[{ Row[{ InputField[Dynamic @ var, Number, ImageSize -> 150], InputField[Dynamic @ unit, String, ImageSize -> 150] }], Button["Print", Print[Quantity[var, unit]]] }] will work just a well as the one you have ...



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