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

first time poster w/ questions.

 [1/3] from: jeremiah::whitehatsec::com at: 12-Dec-2001 16:37


Hello, list... been lurking for couple of weeks now while trying get a feel for Rebol. I must say so far, I really like it... makes a ton of things really fast and easy. Hopefully I can create some cool stuff.... anyway... While coding a few mini-projects, Ive run into a few problems that I havent been able to find answer to elsewhere. Their prolly pretty easy, just cant find the right documentation. 1) In a GUI interface, lets say I have a button.. main: layout [ button "The Answer" ] and I want the button when clicked to add a text field to the window. similar to. field "Text Here" so far it seems I have to predefine everything I want to display. But what if I dont know till later how many text fields I need until the GUI is operating? Any way to dynamically add VID objects? 2) Lets say I have a window thats 200x100. main: layout [ size 200x100 ] Now I want to add a bunch of text or fields and other stuff vertically, but there isnt enough space and it bleeds off the edges. main: layout [ size 200x100 vh2 "Testing Text" field "A text field" vh2 "Testing Text" vh2 "Testing Text" field "A text field" vh2 "Testing Text" ] Questions is, how do I get the window itself to scroll either vertically or horizontally so I dont have to alter the window size? I really appreciate any help. Thanks, Jeremiah Grossman

 [2/3] 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.

 [3/3] from: brett:codeconscious at: 13-Dec-2001 22:08


Hi, Here's another method. In this I build a layout specification (a block) dynamically. Then call layout each time on the new specification and assign the resulting face to pane of a box (see the RT Panel How to). Like Anton I'm using a special scrolling feature to deal with the problem of running out of space. I've put the example on my rebsite "Code C." because I think the email will break the code. Here's the direct url: http://www.codeconscious.com/rebsite/dynamic-layout-example.r Regards, Brett.