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.
> 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?
> Jeremiah Grossman
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.