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

[REBOL] Re: getting dynamically to object word ...

From: petr::krenzelok::trz::cz at: 23-Jan-2003 19:20

Joel Neely wrote:
>Hi, Petr, > >How about an alternative...? > >Petr Krenzelok wrote: > >>Hi, >> >>let's suppose I have dynamically generated UI ... now I need to >>create some function to iterate thru UI elements and get their >>values. I found following way works, but I have two questions ... >> >>for i 1 7 1 [for j 0 4 1 [print do join 'fld [i j "/text"]]] >> >>I simply have fld10, fld12, fld13, fld14 .... fld74 ... >> >>1) Is it safe to use 'do? >>2) Is there any other way of how to dynamically compose name of already >>existing object and get to its words using 'in? >> >> >> > >Instead of dynamically composing the name of an existing object, why >not add the object to a collection (e.g. block) at the point of its >creation? Then you can simply iterate over the collection, calling >whatever method(s) you need for any purpose. > >I've had *VERY* little time with /View (still waiting for the MacOS/X >version...) but did use that technique in a couple of little demos I >wrote early on. (Please forgive any stylistic ugliness or cut&paste >goofs! ;-) A simplified version of the relevant portions would look >something like this: >
Hmm, sounds like grid would be helpfull to me :-) Appending into pane is good thing probably, although I am not sure how should I position the stuff by simply appending it into pane ... and also - it would have to be some kind of subpanel better .... Right now I have following code: txt "Severka:" fld11: fld 30 fld12: fld 150 fld13: fld 30 fld14: fld 30 fld15: fld return txt "Pr(elac(:" fld21: fld 30 fld22: fld 150 fld23: fld 30 fld24: fld 30 fld25: fld return txt "Kozubová:" fld31: fld 30 fld32: fld 150 fld33: fld 30 fld34: fld 30 fld35: fld return ......... sections: [ [ <!--Severka provoz--> <!--Prelac provoz--> <!--Kozubova provoz--> <!--Pod Louckou provoz--> <!--Na Gruni provoz--> <!--Mosty_centrum provoz--> <!--Bahenec provoz--> ] <!--podminky--> <!--teplota--> <!--vyska--> <!--aktualizace--> ] ......... ski: read %ski.html preview-ski-data: does [ for i 1 7 1 [ tmp: head ski for j 1 5 1 [ change/part tmp: find/tail tmp either j == 1 [sections/1/:i][sections/:j] do join 'fld [i j "/text"] find tmp <!--end--> ] ] write %xxx.htm ski browse %xxx.htm ] .... and kind of insane parse replacement - find named section, replace items in html code ... As I now think about it - it can be all done several ways .... Thanks anyway ... -pekr-