Area Resizing
[1/5] from: mattsmac:hot:mail at: 22-Sep-2003 8:30
Any Help you can lend would be appreciated...
Does anyone happen to know what path in a text-list object I need to modify
to make the scroll bar move to the appropriate place after i change the size
of the text-list? If I just change the offset of the /scrl path, i cannot
move it any farther to the right than it started. Something about the
viewable area of the text list perhaps? Here is my code as of now.
resize-areas: does
[
content/size/1: main-form/size/1 - 50 <-----area
files/size/1: main-form/size/1 - 50 <--------text-list
scroller/offset/1: content/offset/1 + content/size/1 <----- slider
show content
show scroller
show files
]
evt-close: func [face event]
[
switch event/type
[
close
[
if connected = 1
[
close remote
;clean up created files
if exists? %preview.html
[delete %preview.html]
if exists? %print.html
[delete %print.html]
if exists? %temp.html
[delete %temp.html]
if exists? %header.gif
[delete %header.gif]
]
quit
]
resize
[
resize-areas
focus main-form
]
]
event
]
This works fine for resizing the area automatically, and the text-list does
resize as well, but the scroll bar for it still hangs out in the middle of
the now larger list.
Let me know what you think,
Matt
_________________________________________________________________
Instant message with integrated webcam using MSN Messenger 6.0. Try it now
FREE! http://msnmessenger-download.com
[2/5] from: antonr:iinet:au at: 23-Sep-2003 16:31
Can you send a simple example script, complete,
so we can see exactly what you mean?
I have a list + scroller demo here:
http://www.lexicon.net/anton/rebol/gui/demo-vid-list-scroller.r
Here is an excerpt that might fix you up quickly:
refresh: func [
/local visible non-visible-part
][
l-block: copy []
; ensure current position can show all its data
visible: n-rows / length? list-data
scroll/data: max min scroll/data (1.0 - visible) 0.0
;scroll/data: 0 ; current position first row
;prepare-list-block 1 ; show from first row
prepare-list-block 1 + to-integer ((length? list-data) - 1 * scroll/data)
; overall size of the scroller, height same as list
scroll/size: to-pair reduce [16 max list-size/y 16]
non-visible-part: (length? list-data) - n-rows
; arrow buttons cause the slider to move by the value of step
scroll/step: either zero? non-visible-part [0][1 / non-visible-part]
; size of the slider (the drag bar)
scroll/redrag (n-rows / length? list-data)
show [my-list scroll]
]
Anton.
[3/5] from: mattsmac::hotmail::com at: 23-Sep-2003 12:15
Any string that is long enough to wrap will do it. I just used a dummy
string of keyboard garbage to test it. Basically lets say the area is
300x200 when the program starts. When the window is resized, i
automatically have the area resize as well, lets say to 500x500. But the
text inside the area stays formatted as if it were still in the 300x200
area. If i click in the area and type a letter, all the formatting fixes
itself to fit the 500x500 area. So I'm thinking that there is just an
evaluation function or something that needs to be called, but I have no idea
what that would be.
Thanks,
Matt
>From: "Matt MacDonald" <[mattsmac--hotmail--com]>
>Reply-To: [rebol-list--rebol--com]
<<quoted lines omitted: 57>>
>To unsubscribe from this list, just send an email to
>[rebol-request--rebol--com] with unsubscribe as the subject.
_________________________________________________________________
Instant message during games with MSN Messenger 6.0. Download it now FREE!
http://msnmessenger-download.com
[4/5] from: greggirwin:mindspring at: 23-Sep-2003 11:53
Hi Matt,
MM> So I'm thinking that there is just an evaluation function or something
MM> that needs to be called, but I have no idea what that would be.
Faces will cache the list of formatted lines (correct me if I
mis-state this VID gurus) in face/LINE-LIST. All you have to do is
clear that and show the face to refresh it.
s: copy ""
insert/dup s "abcdefg " 200
insert-event-func fn: func [face event][
if event/type = 'resize [
; we get the screen face size in face/size here
print a/size: lay/size - 10x10
a/line-list: none
show a
]
event
]
view/options lay: layout [
origin 5x5
a: area 300x200 s wrap
] 'resize
remove-event-func :fn
-- Gregg
[5/5] from: mattsmac:h:otmail at: 23-Sep-2003 14:23
Thanks Gregg, that did the trick.
Matt
Hi Matt,
MM> So I'm thinking that there is just an evaluation function or something
MM> that needs to be called, but I have no idea what that would be.
Faces will cache the list of formatted lines (correct me if I
mis-state this VID gurus) in face/LINE-LIST. All you have to do is
clear that and show the face to refresh it.
s: copy ""
insert/dup s "abcdefg " 200
insert-event-func fn: func [face event][
if event/type = 'resize [
; we get the screen face size in face/size here
print a/size: lay/size - 10x10
a/line-list: none
show a
]
event
]
view/options lay: layout [
origin 5x5
a: area 300x200 s wrap
] 'resize
remove-event-func :fn
-- Gregg
_________________________________________________________________
Get MSN 8 Dial-up Internet Service FREE for one month. Limited time offer--
sign up now! http://join.msn.com/?page=dept/dialup
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted