This post is here to save your time during GUI development in *Mathematica*. And one way to do this is to know where limits are and to be aware of features that are awaiting. ##Intro Usually I don't have to care (it hurts my brain though) about misaligned details, additional/missing pixels. But currently I'm participating in a project where the design matters and I have to follow examples made by a graphics designer. I have to workaround 10 "features" per hour, and I'm not talking about fancy stuff. ##Things to keep in mind when developing complex GUI in *Mathematica*: - ###Styles management/inheritance system (StyleSheets and friend) It is complicated, full of exceptions and only a tip of the iceberg is documented. Those 3 features are limiting the usage of it, which is a pity because it has a potential to give a lot. I'm also missing guidelines about common/basic activities related to stylesheets. [**How is the cell style of a given cell resolved.**](http://mathematica.stackexchange.com/a/14835/5478) [**Updating styles based on styles changed in a private stylesheet**](http://mathematica.stackexchange.com/q/108224/5478) [**How to inspect selected text's style origin?**](http://mathematica.stackexchange.com/q/113495/5478) [**Not needed Stylesheet locked by the FrontEnd**][1] - ###*Mathematica* assumes your `dpi == 72` on Windows whether it is so or not. You can force proper handling of printer's points on HiDPI screens, but are you allowed to do this for the customer's front end? It isn't fully documented and self inconsistent documentation won't help you understand what's going on. [**What is a printer's point?**](http://mathematica.stackexchange.com/q/109813/5478) [**Fontsize is too small**](http://mathematica.stackexchange.com/q/745/5478) [**Magnification, ScreenResolution, ScreenInformation and Printing: Please shine some Light into it!**](http://mathematica.stackexchange.com/q/120463/5478) - ###Mixed units Printer points and font size units (good luck with tracking what is the current one) are only options. And not both but you have to align two different worlds. [**How to convert between various ItemSize/ImageSize units?**](http://mathematica.stackexchange.com/q/1584/89) - ###Lack of full control/documentation of Kernel initialization/deinitialization: [**Handling Kernel start. Autoload place in init stack.**](http://mathematica.stackexchange.com/q/110243/5478) [**Handling Kernel quit**](http://mathematica.stackexchange.com/q/110162/5478) [**How to clean up after a package?**](http://community.wolfram.com/groups/-/m/t/824185) [[...] What you cannot do is to make assumptions about the order in which subsequent DynamicModule or Dynamic expressions will fire, or even if they will fire (if they're not in the same position). [...]](http://mathematica.stackexchange.com/questions/167/what-are-the-most-common-usual-ways-to-make-palettes-with-non-trivial-function/109638#comment3498_1113) [[...] NotebookDynamicExpression not firing in new kernel sessions [...]](http://mathematica.stackexchange.com/questions/167/what-are-the-most-common-usual-ways-to-make-palettes-with-non-trivial-function/109638#comment123110_1113) - ###Issues of a dynamic GUI [**Dynamic cells after Kernel restart/quit**](http://mathematica.stackexchange.com/q/80560/5478): Dynamic based GUI will not digest kernel quit well, and you can't do much about that because of the previous section. [**Evaluation order of DynamicModule and Manipulate**](http://mathematica.stackexchange.com/a/153/89): Particularly handy to know when deciding about *when* to load static functions and packages. [**How Initialization works in DynamicModule**](http://mathematica.stackexchange.com/q/30079/89) [**Nesting DynamicModules to properly divide Front-end and Kernel functionality**](http://mathematica.stackexchange.com/a/116249/89) [**Create a notebook and save it without prompting Dynamics**](http://mathematica.stackexchange.com/q/109651/5478) - ###Ignored options In many gui objects, certain options are ignored. [**Grid - problem with ItemSize being ignored**](http://mathematica.stackexchange.com/q/13399/89) `SetOptions[GraphicsGrid, Frame -> True]; GraphicsGrid@Array[Graphics@Circle[] &, {2, 2}]` ![Mathematica graphics](https://i.sstatic.net/Q8Mog.png) - ###Misaligned frames, additional pixels, imprecise dimensions Extra pixels are introduced in many cases, leading to improper dimensions and misalignments. `test = Framed["TEST", Background -> Red, FrameStyle -> Blue, ImageSize -> {100, 100}]` ![Mathematica graphics](https://i.sstatic.net/pGUJm.png) `Column[{#, #, Column[{#, #}, Spacings -> 0]}, Spacings -> 0] & /@ {test[Blue], test[None]}` [![enter image description here][2]][2] ImageDimensions@Rasterize@test > {100, 102} (* I could live with {102, 102}... *) [**Grid cuts my images**](http://mathematica.stackexchange.com/q/105061/5478) > [![enter image description here][3]][3] [**TabView Alignment problem for content larger than a view area**](http://mathematica.stackexchange.com/q/76397/5478): > [![enter image description here][4]][4] - ###Transparency and background issues [**Transparent bitmaps in controllers bug.**](http://mathematica.stackexchange.com/q/85521/5478) [**Dynamic graphics appears first with wrong background**](http://mathematica.stackexchange.com/q/121082/89) `DensityPlot` and `GeoGraphics` put a white frame around an inset `Button`. {DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3}, ImageSize -> 100, Epilog -> {Inset[Button["Test"], Background -> None]}], GeoGraphics["London", ImageSize -> 100, Epilog -> {Inset[Button["Test"], Background -> None]}]} ![Mathematica graphics](https://i.sstatic.net/sucWV.png) - ###Further problems [**Notebook's WindowSize interference with contents' Dynamic ImageSizes**](http://mathematica.stackexchange.com/q/61659/5478) [**Problem with CurrentValue["MouseOver"] and Deploy**](http://mathematica.stackexchange.com/q/43672/5478) - ###OS dependent features From my experience it is impossible to create precise GUI for Win and Mac. Not all features are OS dependent, and often workaround for one will give you headache in the other. [**Grid layout problems: different sizes when rendering on Mac and Windows**](http://mathematica.stackexchange.com/q/17795/5478) [Not needed Stylesheet locked by the FrontEnd][1] ---------- ##Question **Are there any guidelines to make GUI creation process more stable?** Quick workarounds are not general enough and I don't have time to spend 1 day to align a simple grid. **If not, what should I tell the designer/manager about requirements?** People are used to the fact that you can create very nice layout with css in no time, how to explain that it is impossible, or not worth the time spent, in Mathematica? How to explain why getting rid of "white line" in some secondary menu took me half a day, and I've failed? [1]: http://mathematica.stackexchange.com/q/108640/5478 [2]: https://i.sstatic.net/U3Sh8m.png [3]: https://i.sstatic.net/wSlwj.png [4]: https://i.sstatic.net/ctugc.png