Re: Manually culling a list

*To*: mathgroup at smc.vnet.net*Subject*: [mg115146] Re: Manually culling a list*From*: Mike H <mike.honeychurch at gmail.com>*Date*: Sun, 2 Jan 2011 04:56:42 -0500 (EST)

On Sun, Jan 2, 2011 at 5:11 AM, DrMajorBob <btreat1 at austin.rr.com> wrote: > 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 > Yes when I posted I left out a line that makes the rules. I sent another post about a minute later, you'll find it in this thread. Note that a shortcoming of CheckboxBar is using it for large numbers of checkboxes -- you have to break up the bar to fit it on the page (both horizontally or vertically) and get nice alignment. Appearance->"Row" is not really a realistic aesthetic option for commercial work. It is possible to write some code to make a CheckBoxGrid -- several smaller checkbox bars nicely aligned -- but this functionality probably needs to be built-in in the next version. Mike > > 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 >