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

radio button

 [1/7] from: nicolas::maillard::noos::fr at: 20-Sep-2002 19:58


Hi I'am working on a dynamic code generation in rebol. and i have a pb. I create dynamicaly "n" radio buttons which are all attached in a same group "group1": r1: radio of 'groupe1 text "my info" r2: radio of 'groupe1 text "my info2" etc .. r1, r2, r3 ... are generated and change each time the file is created. How can i do dynamicaly the thing i can't do like : r1/data r2/data. Does groupe1/data work? Plz help me =) thx

 [2/7] from: gscottjones:mchsi at: 20-Sep-2002 15:40


From: "Nicolas Maillard"
> I'am working on a dynamic code generation > in rebol. and i have a pb. I create dynamicaly
<<quoted lines omitted: 5>>
> r1, r2, r3 ... are generated and change each time the file is created. > How can i do dynamicaly the thing i can't do like : r1/data r2/data. Does
groupe1/data work?
> Plz help me =)
Hi, Nicolas, I am not sure that I understand your question. The reason that I am not sure that I understand, is because you should be able to use r1/data, etc. Here is an example of a dynamically laid out display. Just before layout out is called, a line is added that sets r2 to true, which means that it will be selected on start up: blk: copy [] repeat i 2 [ repend blk [ 'across to-set-word join 'r i 'radio 'of to-lit-word 'groupe 'text join "my info" i 'below ] ] repend blk ['do [r2/data: true]] l: layout blk view l After layout has been called, the same paths can be called, like setting r2/data to false. However, the displayed window must manually be told to update using show: view layout [ r1: radio of 'groupe1 text "my info" r2: radio of 'groupe1 text "my info2" button "Change R2" [ r2/data: not r2/data show r2 ] ] Hopefully by rambling I have answered your question. :-) --Scott Jones

 [3/7] from: gchiu:compkarori at: 21-Sep-2002 14:53


>blk: copy [] >repeat i 2 [
<<quoted lines omitted: 14>>
>manually be told to >update using show:
Hi Scott, How do you access r1 .. rn dynamically? -- Graham Chiu

 [4/7] from: nicolas:maillard:noos at: 21-Sep-2002 11:50


HI, i'am trying to explain beter =) i generate a script in dyn the data inside are not the same each time the file is created. so in this file i generated radio buttons whitch are like that : r1: radio of 'groupe1 text "INFO DYN1" r1: radio of 'groupe1 text "INFO DYN2" rn : radio of 'groupe1 text "INFO DYNn" a radion button for validate the choice. So i can't use r1/data or r2/data or rn/data because i never know if he exists. How can i recover dynamicaly the choice of th radio buton? for exemple if he choose the third choice can i use a thing like that : groupe1/data? or other thing thx for all

 [5/7] from: gscottjones:mchsi at: 21-Sep-2002 7:22


From: "Nicolas Maillard" ...
> i generate a script in dyn the data inside are not the same each time the > file is created. so in this file i generated radio buttons whitch are like
<<quoted lines omitted: 7>>
> for exemple if he choose the third choice can i use a thing like that : > groupe1/data? or other thing
Hi, Nicolas, Graham, (and possibly Bertrand :-), OK, I *think* I am understanding more of what you seek. Using some techniques that I have used for passing on events (separate thread with Carl R.), I'll iterate through all the faces looking for the r1 thru rn that contain the "groupe1" marker. This could be done using other markers. In a larger program, I could easily see confining the iteration routine to a subface, like a pane that contains the radio buttons. Hopefully this is getting very close to what you are seeking (watch for line wrap): blk: copy [] repeat i 3 [ repend blk [ 'across to-set-word join 'r i 'radio 'of to-lit-word 'groupe1 'text join "my info" i 'below ] ] append blk [ b: button "Show Radios" [ c: 1 clear t/data while [l/pane/:c] [ if equal? l/pane/:c/facets [of groupe1] [ append t/data rejoin [ l/pane/:c/var "^-" get in l/pane/:c 'data ] ] c: c + 1 ] show t ] t: text-list 100x60 ] l: layout blk view l ;###################### On second thought, if the example is less than clear, I have comment it below: ;empty block to hold dynamically laid out window blk: copy [] ;throw in an arbitrary number of radios ; with groupe1 label repeat i 3 [ repend blk [ 'across to-set-word join 'r i 'radio 'of to-lit-word 'groupe1 'text join "my info" i 'below ] ] ;throw in rest of the layout append blk [ b: button "Show Radios" [ c: 1 clear t/data while [l/pane/:c] [ ;iterate through all the faces ;(could be narrowed if needed to smaller ; subset) and look for desired label if equal? l/pane/:c/facets [of groupe1] [ ;append the radio data info to text-list append t/data rejoin [ l/pane/:c/var "^-" get in l/pane/:c 'data ] ] c: c + 1 ] ;update displayed text-list show t ] t: text-list 100x60 ] l: layout blk view l Let me know if I got the idea right this time. :-) --Scott Jones

 [6/7] from: ingo:2b1 at: 21-Sep-2002 15:30


Hi Nicolas, there may be different ways to do it, I would put the radio buttons into a block, and reference them through there index in the block. Normally I would add the buttons directly after I created the word to hold them, so what I#ll show here is, how to get them out of a layout block. ;-- Rebol file starts -- [REBOL [ Title: "Dynamically named radiobuttons" ] radio-buttons: copy [] lay: [ t7: text "Just an example" r1: radio of 'groupe1 text "INFO DYN1" r2: radio of 'groupe1 text "INFO DYN2" rn: radio of 'groupe1 text "INFO DYNn" button "Set second button" [ ; the words are only defined _after_ layout, so I can't ; get the real buttons before the layout rb: get radio-buttons/2 rb/state: true ; and why are changes not shown? show lay ] ] parse lay [ here: (probe here) some [ to set-word! here: (probe here) [ copy wrd set-word! 'radio ( ; change set-word! to word! ; why is wrd a block? wrd: to word! wrd/1 ; apend the word to the list of ; radiobuttons append radio-buttons wrd ) | skip | to end ] ] ] view layout lay ] ; -- rebol file ends -- I hope this will guide you on your way ... Ingo Am Sam, 2002-09-21 um 11.50 schrieb Nicolas Maillard:

 [7/7] from: rotenca:telvia:it at: 21-Sep-2002 16:35


> i generate a script in dyn the data inside are not the same each time the > file is created. so in this file i generated radio buttons whitch are like > that : > r1: radio of 'groupe1 text "INFO DYN1" > r1: radio of 'groupe1 text "INFO DYN2" > rn : radio of 'groupe1 text "INFO DYNn"
Every face (like a radio) added to a window is appended to the block window/pane. The group is in the field 'related of the radio face. The variable name is in the field 'var of the radio face.
>> w: layout [r1: radio of 'groupe1 r2: radio of 'groupe1 r3: radio of
'groupe1]
>> foreach x w/pane [print [x/var x/related]]
r1 groupe1 r2 groupe1 r3 groupe1 --- Ciao Romano

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted