0
$\begingroup$

I'm building a Manipulate object and I need to reduce the width of the input fields for improved usability. I've tried everything I can, and I don't seem to be able to get it. Everything points to using ImageSize, but that doesn't work when the fields are used within the Control function, which is necessary for the grid layout I'm attempting. I've also tried it using Row, but still have to use Control, and so I have the same problem.

This is a simplified snippet that will illustrate my code.

Manipulate[p1 + p2 + p3 + p4,
 Grid[{
   {Control[{{p1, 0, "p1"}}], Control[{{p2, 0, "p2"}}]},
   {Control[{{p3, 0, "p3"}}], Control[{{p4, 0, "p4"}}]}
   }]]

Is there any way to reduce these input field horizontal lengths from the default length?

$\endgroup$
  • $\begingroup$ Just add the option ImageSize: Control[{{p1, 0, "p1"}, ImageSize -> Tiny}] $\endgroup$ – Ulrich Neumann Jan 22 '19 at 15:53
  • $\begingroup$ .. or Control[{{p3, 0, "p3"}, FieldSize -> Tiny}] $\endgroup$ – kglr Jan 22 '19 at 16:18
0
$\begingroup$

Try this:

Manipulate[
 p1 + p2 + p3 + p4,
 Grid[{{InputField[Dynamic[p1], FieldSize -> 7], 
    InputField[Dynamic[p2], FieldSize -> 7]}, {InputField[Dynamic[p3],
      FieldSize -> 7], InputField[Dynamic[p4], FieldSize -> 7]}}]]

Play with the FieldSize.

Have fun!

| improve this answer | |
$\endgroup$
  • $\begingroup$ That worked great. Thanks! $\endgroup$ – Infinity3 Jan 22 '19 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.