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


23

Don't forget, with M we have all of Java at our fingertips with just a few keystrokes. So why don't you use Java Swing, which is a professional UI framework that runs on hundreds of millions of devices. I have ShowProgressBar and DestroyProgressBar in my init.m, because I use them frequently. Needs["JLink`"] ReinstallJava[] ShowProgressBar[title_String: "...


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


23

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[##];) & @@@ ...


20

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 FrontEnd`AttachedCell. From the code one could learn enough to create something useful: Usage FrontEnd`AttachCell[ parentObject, (*Box or Cell ...


19

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


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


19

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


18

I know of no method by which to control the color of that element. I'm afraid that it may not be possible. I believe the style of the ProgressIndicator is taken from the OS settings, or rather the ProgressIndicator is rendered by the OS. If you look at the on-line documentation for versions 7, 8, 9 you see that the style changes: 7: 8: 9: Further, I ...


18

If you're on version 9, you can use gauges: HorizontalGauge[90, {0, 100}, ScaleRangeStyle -> Red, GaugeMarkers -> "ScaleRange"] I don't fully understand how Mathematica scales and aligns things like gauges (and it's not the sort of thing that's easy to find in the documentation) but I would explore the options using a Manipulate: Manipulate[ ...


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

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 am not sure why you can't just use Grid? Manipulate[Plot[Sin[x], {x, -lim, lim}], Grid[{ {Control[{{lim, Pi, "limit"}, Pi/10, 2 Pi, Pi/10, ImageSize -> Tiny}], Button["A", ImageSize -> 100]}, {Button["B", ImageSize -> 100], Button["C", ImageSize -> 100]}, {Button["D", ImageSize -> 100], Button["E", ImageSize -> 100]} }...


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

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


15

If you look at underlying code: ListAnimate[Table[Plot[Sin[n x], {x, 0, 10}], {n, 25}]] // InputForm at the end you'll find: which leads to a trick: ListAnimate[Table[Plot[Sin[n x], {x, 0, 10}], {n, 25}]] /. HoldPattern[AppearanceElements -> _] -> (AppearanceElements -> None) In the spirit of @Mr.Wizard comment you can also do something like: ...


15

Based on undocumented FrontEnd`AttachCell: What is FrontEnd`AttachedCell? And Experimental`Autocompletebut 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

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


14

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


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


13

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


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: MathLink`CallFrontEnd[ 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

For this solution, I've made rasterized versions of ProgressIndicator, replacing green tones by similarly light/dark red tones by means of a function toRed. All other colors used by default are gray levels, i.e. they match the {c_,c_,c_} pattern. This works fine only for the appearance shown third in Mr. Wizard's answer (also seen below). What's left then is ...


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