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

Dynamically adding boxes to layout

 [1/8] from: robert::muench::robertmuench::de at: 18-Dec-2001 19:30


Hi, I have to followig problem: I'm doing some calculation that results in some object positions. Now I want to draw boxes with these calculcated positions. The number of boxes is not known until run-time. It's easy to do it statically: view layout [ box 25x25 box 10x10 ] Ok, but how do I add further boxes at run-time? Robert

 [2/8] from: pwoodward:cncdsl at: 18-Dec-2001 13:51


Robert - the help in the ref-words has a pretty good example on this under the View -> Show keyword.... out: layout [ h1 "Show Example" t1: text "Text 1" t2: text "Text 2" ] view/new out wait 1 remove find out/pane t2 show out wait 1 remove find out/pane t1 show out wait 1 append out/pane t2 show out wait 1 unview I'd expect you could append out/pane with something if you want to add an item. - Porter

 [3/8] from: james:mustard at: 19-Dec-2001 8:18


Hi Robert, REBOL [] window: layout/size [ box 25x25 gray box 10x10 green button "Click Me!" [ append window/pane make-face/spec 'box [offset: 140x140 size: 20x20 color: red] append window/pane make-face/spec 'box [offset: 180x140 size: 20x20 color: blue] append window/pane make-face/spec 'box [offset: 220x140 size: 20x20 color: yellow] show window ] ] 400x200 view window

 [4/8] from: carl:cybercraft at: 19-Dec-2001 9:23


On 19-Dec-01, Robert M. Muench wrote:
> Hi, I have to followig problem: I'm doing some calculation that > results in some object positions. Now I want to draw boxes with
<<quoted lines omitted: 6>>
> ] > Ok, but how do I add further boxes at run-time? Robert
Depending on what you're after, using View's Draw dialect may be the way to go... view layout [ b: box black 400x200 effect [draw[]] button "Add Box" [ append b/effect/draw reduce [ 'pen random 255.255.255 'fill-pen random 255.255.255 'box random 399x199 random 399x199 ] show b ] ] Each click of the button there adds a box and its color definitions to b's 'draw block, and with it being a block, you can add and remove its contents at will, not to mention adding lines, circles, polygons, text and images too. -- Carl Read

 [5/8] from: robert:muench:robertmuench at: 19-Dec-2001 13:55


> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]On Behalf Of
<<quoted lines omitted: 4>>
> the help in the ref-words has a pretty good example on this under the > View -> Show keyword....
Hi, did I miss something here? What help are you using?
> out: layout [ > h1 "Show Example"
<<quoted lines omitted: 7>>
> wait 1 > remove find out/pane t1
Ah, I didn't had the implied .../pane in mind. It's really not so easy to keep all the Rebol internal objects, series etc. in mind ;-9 What's the best way to set markers so that I can refer to the right place in my layout? Somtimes I want to append/remove/insert etc. IMO it could get hard to build a reference structure that's comfortable to handle at runtime. Thanks for the info. Robert

 [6/8] from: nitsch-lists:netcologne at: 19-Dec-2001 18:44


RE: [REBOL] Re: Dynamically adding boxes to layout [robert--muench--robertmuench--de] wrote:
> > -----Original Message----- > > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]On Behalf Of
<<quoted lines omitted: 22>>
> layout? Somtimes I want to append/remove/insert etc. IMO it could get hard to > build a reference structure that's comfortable to handle at runtime.
sub-layout: make-a-face-somehow and work with sub-layout/pane ?
> Thanks for the info. Robert >
-Volker

 [7/8] from: steve:shireman:semaxwireless at: 19-Dec-2001 14:16


Wow, Just wanted to say this is a _great_ thread. You got me over a couple of scripting stumps I had caught my brain on in an earlier project. Back to the Draw-ing board!! Steve Shireman it's a humbling feeling when I'm handed a great architecture, and the only limit of what I can do is the limit of my own imagination... mouth-view: ankle/insert foot Carl Read wrote:

 [8/8] from: robert:muench:robertmuench at: 20-Dec-2001 10:37


> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]On Behalf Of
<<quoted lines omitted: 3>>
> Subject: [REBOL] Re: Dynamically adding boxes to layout >> What's the best way to set markers so that I can refer to the right place in
my
>> layout? Somtimes I want to append/remove/insert etc. IMO it could get hard to >> build a reference structure that's comfortable to handle at runtime. > > sub-layout: make-a-face-somehow > and work with sub-layout/pane ?
Hi, something like this. I now use the following pattern-of-dumb. graph-layout: [at 0x0 box green effect [draw [(line-face)]]] line-face: [] Now I can add draw-dialect stuff to line-face and later I use: return compose graph-layout. This makes it possible to seperate your layout into individual accessable parts. Robert

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