MathGroup Archive 2011

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

Search the Archive

Re: Manually culling a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115131] Re: Manually culling a list
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Sat, 1 Jan 2011 04:25:56 -0500 (EST)
  • References: <ifhi9c$i2o$1@smc.vnet.net>

Hi,

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

I have seen you got some other solutions, but I wanted to mention that
there is CheckboxBar, which does almost exactly what you try to achieve
with much less trouble:

values = CharacterRange["A", "F"];
selection = {};
CheckboxBar[Dynamic[selection], values, Appearance -> "Vertical"]

this will dynamically set the variable selection to a list of all
checked values. You can check that with this:

Dynamic[selection]

if you need the form you first suggested this would give you such a list:

Map[{MemberQ[selection, #], #} &, values]


of course you could also wrap that into an InputDialog, if you think
that makes sense...

hth,

albert





  • Prev by Date: Re: Manually culling a list
  • Next by Date: Re: Anyone get OpenCL working?
  • Previous by thread: Re: Manually culling a list
  • Next by thread: Re: Manually culling a list