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

[REBOL] Re: How to make a layout from a block

From: moeller_thorsten:gmx at: 19-Apr-2002 10:59

Hi Brett, thanks for your suggestions. As this code is just the beginning test, how a small app to create a seat-plan could work, i have a some additional questions. I improved my own code, but think it is not very elegant. I added two fields to to get the number of rows and columns to generate. Rebol [] ;--- defining seat style saal-styles: stylize [seat: box 6x6 green [seat/color: red]] ;--- Adding seats to layout add-seats: func [ lines [integer!] quantity [integer!] ] [ ;--- Adding lines repeat y lines [ ;--- Adding seats repeat x quantity [ append main [seat] ] append main [below across] ] ;--- generate new window unview/all view/options center-face layout main [no-title] ] ;--- Main Layout main: [ at 2x2 box 220x16 0.0.128 left bold "Seat-Plan-Generator" font [name: "Arial" size: 11] below styles saal-styles backcolor silver text bold "How many lines should be created?" lines: field text bold "How many seats should be created?" qty: field across at 2x150 button "Quit" effect [gradient 0.0.0] [unview/all] button "Create" effect [gradient 0.0.0] [add-seats (to-integer lines/text) (to-integer qty/text)] return ] ;--- Start program view/options center-face layout main [no-title] Your code only generates one seat, even if i click the button several times. The next problem is that i need the seats to store an information so the seats have to look like "seat1: seat". If i add the seats like this i get an error that "seat1" is not defined in this context when the new window is generated. The second one is that the seat should perform an action on click, like changing color or so (see style definition in code). For this reason every seat must be adressable like "seat1" or "seat23" as well, but how can i implement that when the style is defined. There i just can define a general action, not knowing the exact seat number? Perhaps you find a minute to think about it. I will try to solve it on my own as well. Best wishes to the other side of this world. Thorsten