2
$\begingroup$

It does update when I Show or Minimize the Suggestions Bar, but I would like it to update automatically.

list = {1, 2, 3};

Dynamic[Manipulate[{If[addchoice != {}, 
AppendTo[list, Last[addchoice]]; addchoice = {}], list, 
addchoice}, {{addchoice, {}}, 
ListPicker[#1, list, Multiselection -> False] &}]]
$\endgroup$
1
$\begingroup$

This is a little easier with a ButtonBar.

With

list = {1, 2, 3};
Manipulate[
 # :> AppendTo[list, #] & /@ list // ButtonBar,
 {n, None}]

n is there as a placeholder for Manipulate. No doubt this snippet will be used in a larger Manipulate. If not you can use Dynamic instead of Manipulate and remove the n bit.

Hope this helps.

| improve this answer | |
$\endgroup$
  • $\begingroup$ That is really cool! :) But I was hoping for a vertical listing with a scroll bar as the list grew. $\endgroup$ – Paul Oct 3 '16 at 6:38
0
$\begingroup$

You can specify a Dynamic expression for the list of values for your control. Manipulate will then automatically wrap the entire control in Dynamic if necessary:

list = {1, 2, 3};

Manipulate[
 {
  If[addchoice != {}, AppendTo[list, Last[addchoice]]; addchoice = {}],
  list,
  addchoice
  },
 {
  {addchoice, {}},
  Dynamic@list,
  ControlType -> ListPicker,
  Multiselection -> False
  }
 ]

animation

Note that I have used the ControlType option to set the type of control, while the Multiselection option was simply appended to the variable specification.

| improve this answer | |
$\endgroup$

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.