Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: [view] object indirection

From: brett:codeconscious at: 20-Nov-2001 16:56

Hi Patrick,
> I am stuck in a should-not-be-so-difficult problem with > view. I have a lot of checkboxes in a layout, named c1, c2, ... c16. > At one time, given a number X, I would like to do something > on the cX checkbox.
I'm wondering if you need to name the checkboxes. The example below shows a way of using some code to traverse the generated layout to set the checkboxes. Also, an interesting program to read is rebodex.r in the Rebol script library. Brett ; ; Lets generate a layout of 10 checkboxes. ; When the button is pressed a function runs ; through the layout searching for check boxes. ; It sets the every other check box it finds. ; ; I wrap all the code in a context just to tidy things up, ; you can run the code without using a context too. ; checkbox-example: context [ layout-script: copy [ title "A checkbox manipulation example" button "Set checks" [set-odd-boxes] across ] for i 1 15 1 [ append layout-script [check] ] lay: layout layout-script set-odd-boxes: does [ check-count: 0 for i 1 length? lay/pane 1 [ fce: lay/pane/:i if equal? fce/style 'check [ check-count: check-count + 1 if equal? 0 (and check-count 1) [ fce/data: true ] ] ] show lay ; Update the display ] go: does [ ; See the result view lay ] ]