Tag Info

Hot answers tagged

17

If you are serious about using this extensively, consider making a function based on CreateDocument... Here is one way to pursue Szabolcs's line of thought. What follows is a function based on CreateDocument[] that can be used in conjunction with the (now somewhat neglected) option DisplayFunction, which handles where the output of graphics functions ...


14

You can always create a new notebook and put things in it. If you are serious about using this extensively, consider making a function based on CreateDocument that sets the appropriate options for the notebook to look good. Check what CreateDocument@Plot[Sin[x],{x,0,10}] does. Or use a quick-and-dirty hack based on CreatePalette: fig = CreatePalette[#, ...


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)}] ]


7

it is not etirely clear for what you need that, but I think the best way to store data within a Notebook so that it is available in the next session is the TaggingRules option. This is how you could store data for a there: CurrentValue[EvaluationNotebook[],{TaggingRules,"dataset-name"}] = data; And this is how you can read it: data = ...


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


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

Something, that more or less does what you asked for, can be achieved by creating a hidden InitializationCell using a DynamicWrapper DynamicWrapper["xxx", If[foo == 23, MessageDialog["You guessed it!"], MessageDialog["You've guessed the right variable name, but not the right value yet."]]]


4

My approach to this task would be to create new Input Cells within the notebook, that have the same structure as newly typed in symbol definition. createNewSymbol[] := Module[{importFileName = SystemDialogInput["FileOpen", ".txt"]}, With[{importedData = If[StringQ@importFileName, Import[importFileName, "Table"]], symName = ...


4

Ok, I read it again and again and I think I know what you are after. Here's quick fix/adjustment to make this thing a valid controller: SetAttributes[customColorSetter, HoldFirst] customColorSetter[var_] := ( If[! MatchQ[var, _RGBColor], var = Black]; Delete[ FrontEndResource["RGBColorValueSelector"][[1, 1]], {{1, 1}} ] /. ...


3

My comment in Manipulate form: func = {x^2 + x y + y^2}; Manipulate[ D[func, variable], {variable, {x, y}} ] The control that Manipulate uses is the SetterBar[Dynamic[variable], {x, y}] of my comment.


3

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


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

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


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

Your problem is the Set. Set means you're assigning something to a variable (=), x2 Sin[x2] is not a variable. Try Equal[] instead, this is equivalent to ==. Vars = {{(x1) Cos[x2], Sin[x2], 0, (x3) (Sin[x2])}, {(Cos[x2]) (Sin[x4]), (x3) Cos[x4], 1, x1}}; Const = {{1, 0, 0, 1}, {0, 1, 1, 2}}; MapThread[Equal, {Vars, Const}, 2] yields the output: {{x1 ...


3

One can use $Pre to check if an input expression defines the correct variable and is doing so using the correct value. SetAttributes[check, HoldAll] check[new_Set] := (Print["You guessed it!"]; new) /; HoldForm@new == HoldForm@Set[foo, 23] check[new_Set] := (Print[ "You've guessed the right variable name, but not the right value yet."]; new) /; ...


3

Something like this is a good start. I tried to write it in a way to make it easy to expand. ruleListQ[{r__Rule}] = True; (* JSON won't have RuleDelayed *) ruleListQ[_] = False; formatJSON[json_] := Switch[json, _?ruleListQ, (* dictionary *) Column@Replace[json, HoldPattern[a_ -> b_] :> OpenerView[{a, formatJSON[b]}], {1}], _?(ArrayQ[#, _, ...


3

In the documentation of Button, under Options -> Method, it says: By default, button functions are evaluated on a preemptive link and time out after 5 seconds: DynamicModule[{a = "start"}, {Button["does time out", Pause[6]; a = "end"], Dynamic[a]}] Use Method->"Queued" to evaluate button functions on the main link, which never times out: ...


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

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

Implementation 1 This should produce the desired GUI. askUser[matrix_] := DialogInput[ Column[{ Grid[{ToString@#1, InputField[Dynamic[#1], FieldSize -> Tiny], ToString@#2, InputField[Dynamic[#2], FieldSize -> Tiny]} & @@@ matrix, Alignment -> Left], Row[{CancelButton[], DefaultButton[DialogReturn[matrix]]}] }]] ...


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


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

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

As Arnoud Buzing has mentioned, when manually entering an RGBColor, in the code completion we find a user interface for finding the color components. This user interface is the same as that turns up when we click on a displayed RGBColor expression. I was wondering if this new interface could be used with Dynamic as well. Kuba showed that when we replace one ...


1

This should produce the desired dialog loop pdGUIstyled[func_, outputList_: {}] := Setting@DynamicModule[{variable}, Module[{symboles = Cases[func, _Symbol, Infinity] // DeleteDuplicates, lastRes}, lastRes = DialogInput[ Column[{ Row[{"the function is: ", Panel[func, Background -> White]}], "", Row[{"the current list of ...


1

This is based on Kuba's deleted answer. I agree with his observation that "clearer [the] code the easier to fix". So here is Kuba's code made clearer. DynamicModule[{pl, tbl, n = 1, x = 45 °, calculation = False, procedure}, Dynamic[MouseAppearance[ Column[{ If[calculation, ProgressIndicator[Appearance -> "Percolate"], ...



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