Re: Manually culling a list
- To: mathgroup at smc.vnet.net
- Subject: [mg115154] Re: Manually culling a list
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Sun, 2 Jan 2011 04:58:24 -0500 (EST)
That fails (AS DESCRIBED): list = CharacterRange["A", "F"]; CheckboxBar[Dynamic[x], list] list[[x]] {"A", "B", "C", "D", "E", "F"}[[{"A", "D", "F"}]] Part::pspec: Part specification {A,D,F} is neither an integer nor a list of integers. >> But success is hidden within: x {"A", "D", "F"} Documentation includes the simple example {CheckboxBar[Dynamic[x], {1, 2, 3}], Dynamic[x]} and this is also interesting: {TogglerBar[Dynamic[y], Range[5]], Dynamic[y]} In both cases, elements are added to x in the order that check-marks are added. Bobby On Sat, 01 Jan 2011 03:24:28 -0600, Armand Tamzarian <mike.honeychurch at gmail.com> wrote: > On Dec 30 2010, 8:10 pm, ntg <ntgl... at gmail.com> wrote: >> Hello guys, >> >> Suppose I have a longish list of items that I want to manually cull. >> It seems I should be able to do something like >> >> checkList = ({Checkbox[], #)& /@ list >> >> Then, I could write >> >> instanceOfCheckList = checkList >> >> check away, and hopefully see something like >> >> {{True, item1}, {False, item2}, ...} >> >> which I could manipulate. But all I see is the the list of "checked" >> checkboxs and items, not the consequence of checking the boxes. I can >> do a FullForm on instanceOfCheckList and extract what I need via list >> surgery-- but that is inelegant. I'm sure there is some magic >> incantation involving Evaluate or Interpretation or Dynamic. Can you >> help? >> >> Thanks, >> Tom > > > It looks to me like CheckboxBar is what you need. > > CheckboxBar[Dynamic[x], list] > > then make your manual selections, then to recover your selections: > > list[[x]] > > Note that on a Mac CheckboxBar has a formatting issue when you display > it vertically (WRI tech support have logged this bug) the labels, if > you have word labels, do no align very well with the check box. > > Mike > -- DrMajorBob at yahoo.com