Interaction of InputField with Row (but not Column, Grid or Panel)


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

     opts = { FieldSize -> 10, FieldHintStyle -> {Black}, 
       Appearance -> Framed};
      {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?


Posted 2013-08-23T20:09:53.030

Reputation: 14 508

Still the same (bug?) problem in v 11.0.1 – SquareOne – 2017-02-06T14:55:54.723



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

 opts = {FieldSize -> 10, Appearance -> Framed};
   InputField["", String, opts],
   InputField["", String, opts], 
   InputField["", String, opts]
 }] // Deploy


Posted 2013-08-23T20:09:53.030

Reputation: 259 163

That works, but how ugly that it's necessary for Row and not Column or Grid? What's the reason? – alancalvitti – 2013-08-23T20:37:50.797

@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. – Mr.Wizard – 2013-08-23T20:43:03.407

I can tab between fields even if arranged with Column and Grid. – alancalvitti – 2013-08-23T20:45:13.487

@alancalvitti I was suspecting that Grid will work while Column will show the same behavior as Row but now it's strange... – Kuba – 2013-08-23T21:17:21.983

@Kuba Grid and Column are both GridBox so should behave same. Row is RowBox. Would have though tab should work on all though. Since it does work in earlier versions it looks like a bug to me. – Mike Honeychurch – 2013-08-23T22:37:59.747

1The Row option Selectable -> False also seems to work. – Michael E2 – 2013-08-24T03:40:09.413

@MichaelE2 Yes, that works too. Any reason to prefer it over Deploy? – Mr.Wizard – 2013-08-24T06:08:08.897

I don't have a reason to prefer either, except Deploy is less typing. Oddly, Selectable -> True with Column/Grid does not make it operate like the default Row. I suspect @MikeHoneychurch is right, or there's a deeper reason for Row to behave differently. – Michael E2 – 2013-08-24T11:22:04.220