How might I construct a function called EmToPX[p]
such that the following 2 InputField
s would be the same width. If not please explain why doing such isn't possible.
InputField["a", ImageSize -> 100]
InputField["a", FieldSize -> EmToPX[100]]
After some trial an error ~7.2 appears to be the proper number of EMs above( InputField["a", FieldSize -> 7.2]
), but after trying to convert to a function using proper ratios it appears such technique doesn't work very well.
EmToPX[p_] := (N[
p (1.888888 + CurrentValue[EvaluationNotebook[], "FontSize"]) ]);
Manipulate[
Column[{
InputField["a", ImageSize -> EmToPX[a]],
InputField["a", FieldSize -> a],
EmToPX[7.2]
}]
, {a, 1, 100}
]
Background: Ultimately I am working with Grid
elements and would like an easy way to switch back and froth between CellSize
,ImageSize
,ItemSize
,FieldSize
.
Grid
, then for the love of all that is good and holy, don't do it this way. UsePane
to define your constraints, and letGrid
just snap itself to thePane
elements. $\endgroup$