Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a Panel with 4 Inputfields and a Button. When a Button is clicked, it shifts itself and adds two Inputfields in its place. Before clicking Button,

enter image description here

and after clicking Button.

enter image description here

I want to know how can I shift Button ?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

You could use Dynamic as in :

iField = Table[InputField[], {i, 2}, {j, 2}];

Panel[Dynamic@Grid[Join[iField, {{Button["Add", 
   AppendTo[iField, {InputField[], InputField[]}]], ""}}]]]
share|improve this answer

A recursive solution would allow for the fields to stay intact when adding

DynamicModule[{var = False},
    Column[{Grid[{{InputField[], InputField[]}}],
      Dynamic[If[var, #0[], Button["Add", var = True]]
    ] &[] // Panel

However, you won't be able to go above approximately 50 I think

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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