Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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.