MathGroup Archive 2010

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

Search the Archive

Re: Manually culling a list


Hi,

In[1]:= list = CharacterRange["A", "F"]
Out[1]= {"A", "B", "C", "D", "E", "F"}

In[2]:= selected = {a, b, c, d, e, f};

In[3]:= checks = Map[Composition[Checkbox, Dynamic], selected]
Out[3]:= (*Checkboxes appear here*)

In[4]:= culledlist = Dynamic@Pick[list, selected]

Out[4]= (*Dynamic list of selected items appears here*)

(*The list in the format you described*)
In[5]:= Partition[Riffle[list, selected], 2]
Out[5]= {{"A", True}, {"B", True}, {"C", True}, {"D", False}, {"E",
   True}, {"F", False}}

Cheers,
Zach

On 12/30/2010 1:10 AM, ntg 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
>



  • Prev by Date: Re: Behavior of Eigenvalues and Eigensystem
  • Next by Date: Re: syntax error in Mathematica 8
  • Previous by thread: Re: Manually culling a list
  • Next by thread: Re: Manually culling a list