# Tag Info

30

You can do this using Show and PlotRange which can be used in combination with graphs. To determine the full PlotRange of the original Graph you could use AbsoluteOptions to determine the values of the VertexCoordinates of the graph. The function CoordinateBoundingBox, introduced in V10.1, is helpful here: SeedRandom[1110]; g = RandomGraph[{70, 200}] {...

30

This is a prototype, it can not handle Text Inset and some more complicated directives efficiently but I don't have time / motivation to improvie it. Here's something fun: g = Normal @ Show @ CommunityGraphPlot[ ExampleData[{"NetworkGraph", "DolphinSocialNetwork"}] ]; dist = Normalize[#] (2./Pi ArcTan[Norm[5 #]]) &; DynamicModule[{drag,pts,prims}...

25

A lot can be tweaked, but it is hardly ever straightforward: img = Import["http://biology.usf.edu/cmmb/images/cells2.jpg"] roiSelector[img_] := DynamicModule[ {v, pt1, pt2, dim, imgDim = ImageDimensions@img, w = 300, wI, h = Automatic, ratio } , ratio = #/#2 & @@ imgDim; dim = Round[w imgDim/imgDim[[1]]]; pt1 = .3 dim; pt2 =...

24

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

24

In this case I don't know how to post something helpful without providing full code so I'll just do that and hope this wasn't homework. My emphasis is on clarity (hopefully) rather than brevity or peak efficiency. flip = # /. {LightRed -> LightBlue, LightBlue -> LightRed} &; flipNeighbors[i_, j_] := (color[##] = flip @ color[##];) & @@@ ...

23

I have finished a project where widgets like this have been useful so I thought I would share. By combining InputField and PopupMenu a searchable popup selection table can be created. searchPopup[Dynamic[selection_], list_List] := DynamicModule[{x = ""}, Grid[{{ InputField[Dynamic[x], String, Appearance -> "Frameless", ...

21

The issue with such multicontroller dynamic interfaces is that one usually wants to store the state of all controllers in one variable for convenience (e.g. store status of position {i, j} as state[{i, j}] := "flagged" or state = <|{1, 1} -> 2, {1, 2} -> "flagged", ...|>). On one hand, this makes assignments easy during updating, but on the other ...

21

Intro One day I was playing with Developer package and found DateSetter which uses some kind of floating elements that I found useful. After taking a look at a source code I found out it was FrontEndAttachedCell. From the code one could learn enough to create something useful: Usage FrontEndAttachCell[ parentObject, (*Box or Cell ...

21

Here is a very crude first implementation (code at the bottom): (note that the updated version is called as dragDropList[Dynamic@l) Some notes: The black box serves both as insertion marker and as spacer to move the other items out of the way - obviously, it will need some better styling I'm not sure what the best size for the insertion point is - one ...

19

Edit: Fading overlay window In order to get a top dock element with real transparency, one can create a window that overlays the current notebook window and adjusts its position together with it. With[{nb = EvaluationNotebook[]}, DynamicModule[{wm, ws}, CreateWindow[ PaletteNotebook[ {DynamicWrapper[TextCell["Click OK to close", Orange], ...

18

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

17

OK, I guess I found something myself while trying to circumvent RunScheduledTask. DynamicModule[{prog = False}, Column[{ Button[ "Do heavy work", prog = True; Pause[10]; prog = False, Method -> "Queued" ], Dynamic@If[prog, ProgressIndicator[Appearance -> "Percolate"], Invisible[ProgressIndicator[Appearance ->...

17

n = 120; names = Range[n]; pts = AssociationThread[names -> N@CirclePoints[n]]; edges = RandomSample[Subsets[names, {2}], 250]; There are two reasons why Dynamic scales badly: there is no (documented) way to tell a "DynamicObject" to update, one can only count on dependency tree which is created. one can track only Symbols The second one implies that ...

17

The quick fix is to use Block: Animate[ Block[{\$PerformanceGoal = "Quality"} , Plot3D[Sin[t x y], {x, -3, 3}, {y, -3, 3} , PlotRange -> {0, 1.2} ] ] , {t, 0, 2} , AnimationRunning -> False , DisplayAllSteps -> True ]

17

EDIT: converted the use of explicit Hold wrappers to appropriate HoldAll and HoldFirst attributes of helper functions. Also added possibility to change columns together with rows, and added highlighting of rows/columns that are being moved. The following is a possible implementation, allowing to visually switch neighbouring rows and columns via mouse ...

16

I'm not sure if this is exactly what you need but this is what I've recently done to inform the user about ongoing calculation. Usage withProgressIndicator[proc, delay] Performs a proc, and when it lasts longer than delay (default 0), a progress indicator in dialog is created. It will be closed after finishing the proc. It should be run on Main Link, ...

16

The fix is to move Animate outside of LocatorPane, but let's go couple of steps further: I turned Eigenvalues procedure into a function calculate[] to prevent code duplication The second argument of Dynamic in Slider and LocatorPane is used to neatly invoke calculate[] 'Nested Dynamic' and 'combining dynamic plots without Show ' tricks are used, read more ...

16

I once approached this. I never finished it so let me know if you face any issues: ResourceFunction["GitHubInstall"]["kubapod", "mgui"] << MGUI And here is an example: DynamicModule[{ labels = Range[7] } , labels[[1]] = Style[1, "Section"] ; Grid[{ { "Default", "ContinuousAction", "", "ref"} , { MSorter[Dynamic@labels] , MSorter[...

15

Based on undocumented FrontEndAttachCell: What is FrontEndAttachedCell? And ExperimentalAutocompletebut this can be replaced with Mike's approach. Need to work on style, automatic scrolling and some edge cases, but already works quite well. Feedback appreciated. Column[{ searchPopup2[Dynamic[selection], list], Graphics@Disk[] }] Code ...

15

This answer builds on @AlbertRetey's answer where, in the comments, you wanted some guidance as to how Wolfram creates robust controls. Think very carefully about the division of labor between the FE and the kernel. You've effectively embedded the entire implementation inside the FE by putting the update functions in DynamicModules. Generally, this is a ...

15

You are almost there but VertexDelete[graph, n] or e.g. SetProperty[graph, spec] won't affect graph they way you are expecting unless you set it again: graph = VertexDelete[graph, n]. DynamicModule[{graph} , Dynamic[graph] , Initialization :> ( graph = Graph[ {1 -> 3, 2 -> 3, 3 -> 6, 4 -> 6, 1 -> 5, 5 -> 4, 6 -&...

15

J. Fultz' answer indicates that it is not a bug but a feature which needs better documentation. Get a habit of defining your procedures with [], e.g. f[]:=Print[1]. (Which creates DownValues instead of OwnValues). DynamicModule saves its variables' OwnValues in the first argument of that DynamicModule. Which does not support SetDelayed and is sliently ...

13

Building on Kubas code here is an alternative which solves some (minor) problems: it will not leave behind scheduled tasks when the abort button is used, it works equaly well when the Alt+. shortcut is used to abort and it might work better when aborting preemptive evaluations. Here is the code: SetAttributes[withProgressIndicator, HoldFirst]; ...

12

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: MathLinkCallFrontEnd[ FrontEnd...

12

I decided to create a repository of usually undocumented lists (or just a links to similar topics) of available options: AppearanceElements for Manipulate and friends MouseAppearance styles All Font families All the Properties that ColorData supports? Events for EventHandler. AFAICT additional two that work: "MouseExited"/"MouseEntered" ...

12

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

12

By default, DynamicModule uses SynchronousInitialization -> True. This causes the initialization to be performed on the preemptive link, disabling any updates to the front-end. In particular, print statements, cell creation and dynamic box updates will all be deferred until the initialization completes. If we wish to monitor that initialization within ...

12

I would suggest using the second argument of Dynamic: DynamicModule[{shape = Disk[], targets = RandomPoint[Disk[], 10]}, Panel@Column@{ Item[ RadioButtonBar[Dynamic[ shape, (targets = RandomPoint[#, 10]; shape = #) & ], {Disk[] -> "Disk", Rectangle[] -> "Rectangle"}], Alignment -> Center ], Dynamic@...

12

Both solutions are undocumented but I don't think they will go away. Menu/MenuItem are used internally for a long time and AttachedCell is a relatively new concept but many of new features use it. E.g. DateSetter[], suggestion toolbar, image tools, message stack preview, etc. ContextMenu Quite out of the box. One needs to remember to use KernelExecute for ...

11

You can get custom colors and rounded corners by adding a custom frame to a frameless InputField. The following code approximates the look of Wolfram Alpha's input field: With[{opts = {FrameMargins -> 0, ImageMargins -> 0}}, Framed[ Framed[InputField[, ImageSize -> {500, 25}, Appearance -> "Frameless"], FrameStyle -> ...

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