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

[REBOL] Re: To do or not to do?

From: sanghabum:aol at: 29-Nov-2001 5:30

Thanks again Romano,
> things are more simple of what you think. I have only removed the string and > the function and (almost) everything works as you want. > The only differences are: <snip>
I appreciate the effort you and all the others have taken to show me the error of my ways. I've reworked your code to fit my "real world" -- both Boxcolor and Lastfield musy be strings -- they are sourced from a spreadsheet. And it works with Compose. I dunno, this sort of thing is a matter of taste as much as anything, but I reckon the original "makelayout" is an easier bit of code to follow and amend than the version below. The compose version needs several Rebol tricks (to-set-word, get to-word) that the (perhaps brain-dead and inelegant) string 'em up original doesn't. (And I guess when I write code, the target audience I have in mind includes the maintenance programmer in 5 years time who is not an expert in either the system or the languages used but, nonetheless has to make modifications fast.) Thanks all again, Colin ========================================= Wanted: [across b: box 99x100 green Return c: box 45x33 green + 150.150.150 zz: text "last field" ] ;; Various bits of derived data needed ;; =================================== MaxBoxWidth: 99 MaxBoxdepth: 100 BoxColor: "Green" LastField: "zz" ; a way with compose givem BoxColor is a String ;; ============================================ MakeLayout: func [/local lay] [ lay: compose [ across b: box to-pair reduce [MaxBoxWidth MaxBoxDepth] (get to-word boxcolor) return c: box to-pair reduce [to-integer MaxBoxWidth / 2 to-integer MaxBoxDepth / 3] ((get to-word boxcolor) + 150.150.150) (to-set-word :lastfield) text "last field" ] return lay ] ;; go do it ;; ======== unview/all view layout makelayout