Skip to main content
8 of 24
added 2 characters in body
Kuba
  • 137.7k
  • 13
  • 289
  • 751

Guidelines for planning custom GUI in Mathematica

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

##Let me show you couple of examples:

  • ###Misaligned frames:

      test = Framed[  "TEST",
        Background -> Red, FrameStyle -> Blue, ImageSize -> {100, 100}
      ]
    

enter image description here

  • ###Lack of a precise control over the output size:

      ImageDimensions @ Rasterize @ %
    
 {100, 102} (*I could live with {102, 102} ... *)
  • ###Additional pixels everywhere:

      test = Framed[   "TEST",   Background -> Red,   FrameStyle -> #  ] &;
    
      Column[{
          #, #,
          Column[{#, #}, Spacings -> 0]
         }, Spacings -> 0] & /@ {test[Blue], test[None]}
    

enter image description here

  • ###"Features" everywhere

When you go with bitmap based GUI you think it's going to be lovely day, and then e.g. Grid cuts my images or Transparent bitmaps in controllers bug..

TabView Alignment problem for content larger than a view area

Notebook's WindowSize interference with contents' Dynamic ImageSizes

Problem with CurrentValue["MouseOver"] and Deploy

  • ###Painful mix of 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?

  • ###Not "well defined or documented" behaviors:

Dynamic cells after Kernel restart/quit.

  • ###Ignored options

    Grid - problem with ItemSize being ignored

    SetOptions[GraphicsGrid, Frame -> True]; GraphicsGrid@Array[Graphics@Circle[] &, {2, 2}]

     ![Mathematica graphics](https://i.sstatic.net/Q8Mog.png)
    
  • ###MMA doesn't care about your resolution:

Unless you force it, but are you allowed to do this for the customer front end?

Let's say you have to create something according to the plan with pixel measures, do you know that MMA assumes you have 72dpi screen? Fontsize is too small

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


Give me couple of days and I will make this post 3 times bigger (just saying, don't have time for that).

##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?

Kuba
  • 137.7k
  • 13
  • 289
  • 751