3
$\begingroup$

In Mathematica 9, there's an interaction between InputField and Row. The following fragment (without or without Module and options):

  Module[{opts},
     opts = { FieldSize -> 10, FieldHintStyle -> {Black}, 
       Appearance -> Framed};
     Row[
      {InputField["", String, FieldHint -> "Field 1", opts],
       InputField["", String, FieldHint -> "Field 2", opts],
       InputField["", String, FieldHint -> "Field 3", opts]}]
     ]

Will correctly output the row of input fields and correctly handle text entered in the first field chosen by the user (not necessarily "Field 1"), but tabbing to and entering text in next field is converted to input form.

Whereas, removing Row, as in:

{InputField["", String, FieldHint -> "Field 1"],
 InputField["", String, FieldHint -> "Field 2"],
 InputField["", String, FieldHint -> "Field 3"]}

Results in correct operation (including tabbing across fields). Passing the above list to Panel, Column or Grid (make two sets lists) also works fine.

Known issue?

$\endgroup$
1
  • $\begingroup$ Still the same (bug?) problem in v 11.0.1 $\endgroup$
    – SquareOne
    Commented Feb 6, 2017 at 14:55

1 Answer 1

3
$\begingroup$

I believe you need Deploy to keep the Row elements from being selectable.
Here in version 7 compatible format:

Module[{opts},
 opts = {FieldSize -> 10, Appearance -> Framed};
 Row[{
   InputField["", String, opts],
   InputField["", String, opts], 
   InputField["", String, opts]
 }] // Deploy
]
$\endgroup$
8
  • $\begingroup$ That works, but how ugly that it's necessary for Row and not Column or Grid? What's the reason? $\endgroup$ Commented Aug 23, 2013 at 20:37
  • $\begingroup$ @alan Well, Tab doesn't seem to move between the fields of a Column or Grid so you don't see this specific problem, but strictly speaking I think Deploy should be used with all three, as otherwise you can select and overwrite the fields. $\endgroup$
    – Mr.Wizard
    Commented Aug 23, 2013 at 20:43
  • $\begingroup$ I can tab between fields even if arranged with Column and Grid. $\endgroup$ Commented Aug 23, 2013 at 20:45
  • $\begingroup$ @alancalvitti I was suspecting that Grid will work while Column will show the same behavior as Row but now it's strange... $\endgroup$
    – Kuba
    Commented Aug 23, 2013 at 21:17
  • 1
    $\begingroup$ The Row option Selectable -> False also seems to work. $\endgroup$
    – Michael E2
    Commented Aug 24, 2013 at 3:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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