0
$\begingroup$

I'm doing a program in mathematica with which I have custom interface where I input some previously measured equivalente resistances and calculate the actual resistance, by solving a 8 nonlinear equations using FindRoot. So, since GUIkit has been deprecated, I created a dialog box where I ask for the inputs and (still to be coded) solve the equations after clicking "compute". One thing I wanted to do was being able to use tab to move from one inputfield to another while I entered the resistances values instead of clicking them one by one. Is there anyway I can do this?

CreateDialog[

  {Row[{TextCell["Equivalent Resistance 1: "], 
     InputField[Dynamic[req1], Number, FieldSize -> {5, 1}]}],
   Row[{TextCell["Equivalent Resistance 2: "], 
     InputField[Dynamic[req2], Number, FieldSize -> {5, 1}]}],
   Row[{TextCell["Equivalent Resistance 3: "], 
     InputField[Dynamic[req3], Number, FieldSize -> {5, 1}]}],
   Row[{TextCell["Equivalent Resistance 4: "], 
     InputField[Dynamic[req4], Number, FieldSize -> {5, 1}]}],
   Row[{TextCell["Equivalent Resistance A: "], 
     InputField[Dynamic[reqa], Number, FieldSize -> {5, 1}]}],
   Row[{TextCell["Equivalent Resistance B: "], 
     InputField[Dynamic[reqb], Number, FieldSize -> {5, 1}]}],
   Row[{TextCell["Equivalent Resistance C: "], 
     InputField[Dynamic[reqc], Number, FieldSize -> {5, 1}]}],
   Row[{TextCell["Equivalent Resistance D: "], 
     InputField[Dynamic[reqd], Number, FieldSize -> {5, 1}]}],
   Button["Compute"]},
  WindowTitle -> "Wheatstone Bridges"
  ];
$\endgroup$
3
$\begingroup$

Within a single cell, the default behavior of Tab is to move between InputField objects. This means you want your CreateDialog call to create a single cell instead of multiple cells. Now:

CreateDialog[ {expr1, expr2, ..} ]

will create a separate cell for each of the expri objects, while:

CreateDialog[ Column[{expr1, expr2, ..}] ]

will create a single cell with each of the expri inside a Column. So, try:

CreateDialog[
    Column[{
        Row[{
            TextCell["Equivalent Resistance 1: "],
            InputField[Dynamic[req1],Number,FieldSize->{5,1}]
        }],
        Row[{
            TextCell["Equivalent Resistance 2: "],
            InputField[Dynamic[req2],Number,FieldSize->{5,1}]
        }],
        Row[{
            TextCell["Equivalent Resistance 3: "],
            InputField[Dynamic[req3],Number,FieldSize->{5,1}]
        }],
        Row[{
            TextCell["Equivalent Resistance 4: "],
            InputField[Dynamic[req4],Number,FieldSize->{5,1}]
            }],
        Row[{
            TextCell["Equivalent Resistance A: "],
            InputField[Dynamic[reqa],Number,FieldSize->{5,1}]
            }],
        Row[{
            TextCell["Equivalent Resistance B: "],
            InputField[Dynamic[reqb],Number,FieldSize->{5,1}]
            }],
        Row[{
            TextCell["Equivalent Resistance C: "],
            InputField[Dynamic[reqc],Number,FieldSize->{5,1}]
            }],
        Row[{
            TextCell["Equivalent Resistance D: "],
            InputField[Dynamic[reqd],Number,FieldSize->{5,1}]
            }],
        Button["Compute"]
    }],
    WindowTitle->"Wheatstone Bridges"
];
$\endgroup$
  • $\begingroup$ It worked like a charm! Thank you very much! $\endgroup$ – RicardoP Aug 9 '17 at 16:00

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.