Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Manually culling a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115125] Re: Manually culling a list
  • From: Armand Tamzarian <mike.honeychurch at gmail.com>
  • Date: Sat, 1 Jan 2011 04:24:40 -0500 (EST)
  • References: <ifhi9c$i2o$1@smc.vnet.net>

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

I left a step out when I pasted my previous reply. I don;t have a copy
so I'll start from scratch.

list = {a, b, c,d,e,f}

newList = Rule @@@ Transpose[{Range[Length[list]], list}] (* left this
step out previously*)

CheckboxBar[Dynamic[x], newList]

make your selections then recover the parts you want from your list
using Part:

list[[x]]

(note that this will be an unsorted list because the parts are taken
in the order clicked)

Mike



  • Prev by Date: Re: Default Lighting for Graphics3D
  • Next by Date: Re: Manually culling a list
  • Previous by thread: Re: Manually culling a list
  • Next by thread: Re: Manually culling a list