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

[REBOL] Adding vars at runtime - some progress

From: jeperk::swbell::net at: 10-Jun-2003 23:44

I have been playing with adding addressable buttons and other objects at runtime and have been hitting walls. Today I did manage to add a button that is addressable, however I am doing it by hand. Below is a modified version of Anton's demo-window-relayout.r If I make new buttons using the currently uncommented line, it works. If you try out the slider before making a new button, it fails as it should. There is no b1 yet. After making a new button, it works. Again, it is functioning correctly. If I create a new line during execution that probe shows as equivalent it does not function, the layout does not accept the variable. By commenting one line and uncommenting the other, you can see the effect. How do the blocks inserted differ and how do I fix it? Thanks, John rebol [] numvars: 1 colon: "^:" buttvar: to-word "b" colon: to-word colon lay-blk: [ backdrop effect compose [gradient 1x1 (blue / 2) (green / 2)] text "Slider adjusts button b1" white slider 200x16 [b1/size/x: value * 100 show b1] button "new button" [ ;--create button to insert-------------- newblock: copy [button "Hello"] newone: copy [] newone: join buttvar [numvars colon] newone: to-word newone insert newblock newone numvars: numvars + 1 probe newblock ;--------------------------------------- ; comment only one of these two lines -------------------- append lay-blk [b1: button "Hello"] ;WORKS ;append lay-blk newblock ;DOES NOT WORK ;--------------------------------------------------------- new-lay: layout lay-blk lay/size: new-lay/size lay/pane: new-lay/pane ; steal the panes foreach pane lay/pane [ ; set the parent-face correctly pane/parent-face: lay ] show lay ] ] view/new lay: layout lay-blk wait none