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

[REBOL] Re: first time poster w/ questions.

From: arolls:idatam:au at: 13-Dec-2001 20:14

1) Dynamically add text fields (FIELD style) to a layout view lay: layout [ button 200 "add another field" [ append lay/pane make-face/offset 'field (get in last lay/pane 'offset) + 0x32 lay/size: lay/size + 0x32 ; field height plus some space show lay ] ] ;easy eh? 2) Scrolling a window using a scrollpanel ; rope in some brilliant code from other developers on the list do load-thru url: http://anton.idatam.com.au/rebol/library/scroll-panel.r ; You may want to modify it to remove the demo at the end... ; just uncomment the comment :) ; Look at it in your public cache: ;editor path-thru url main: layout [ origin 0 ; no border around our scrollpanel, thanks styles utility-styles sp: scrollpanel 150x100 subface [ vh2 "Testing Text" field "A text field" vh2 "Testing Text" vh2 "Testing Text" field "A text field" vh2 "Testing Text" ] ] Then later you might want to make the window resizeable and capture the resize event so you can update the size of the scrollpanel's subface. Ask again when you get there :), but here's how to make the window resizeable: view/options main [resize] Ah heck, here's how to capture the event. (Must be done in this order). 1) necessary step because VIEW modifies the feel. view/new/options main [resize] 2) main/feel: make main/feel [ detect: func [face event][ if event/type = 'resize [ print 'resize ] return event ; let it down the event pipeline ] ] 3) wait none ; wait for user input Now, where we have captured the resize event we can stick in our scrollpanel resizing code. See the example in the scrollpanel source. (Actually, I didn't get it to work just now, but it's a bit tricky with order-dependant stuff - I know it can be done.. Later..) Anton.