Layout too big for it's window
[1/8] from: al:bri:xtra at: 6-Dec-2001 22:35
I've got a Rebol/View layout that's too big for it's window. It's a list of
names and checkboxes (an attendance record for students), which is "taller"
than the screen is. After some work, and fiddling around I managed to put
the layout into a panel, add a scrollbar and get the scroll bar to scroll
the layout. But that seemed a lot of work. Is there a easier way?
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[2/8] from: james:mustard at: 6-Dec-2001 23:19
Hi Andrew,
Using a List widget might make that easier :)
James.
[3/8] from: al:bri:xtra at: 7-Dec-2001 6:53
James wrote:
> Using a List widget might make that easier :)
Uhm, please tell me where to find one. Thanks!
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[4/8] from: greggirwin:mindspring at: 6-Dec-2001 11:12
Hi Andrew,
<< I've got a Rebol/View layout that's too big for it's window. It's a list
of
names and checkboxes (an attendance record for students), which is "taller"
than the screen is. After some work, and fiddling around I managed to put
the layout into a panel, add a scrollbar and get the scroll bar to scroll
the layout. But that seemed a lot of work. Is there a easier way? >>
I don't know of an easy way, but the old ToDo sample might have some tricks
in it to make things a *little* easier. Not sure. Either that, or maybe
build a fixed size layout and then have options for viewing items 1 to n,
n+1 to n+z, etc.
--Gregg
[5/8] from: james:mustard at: 7-Dec-2001 12:27
Hi Andrew,
Here's a modified example of one of Jeff Kreis tables to include check box
functionality:
context [
;- The database
tdata: [
["Adamson" "Sarah" 0]
["Adamson" "John" 1]
["Battey" "Nora" 0]
["Roberts" "Julia" 1]
["Spencer" "Frank" 1]
]
;- For the scroll bar
cnt: 0
view layout [
across
space 0
tbl: list 220x400 [across space 0 text 100 text 100 check [tmp:
(face/parent-face/offset/y / face/parent-face/size/y) + 1 if tmp <= length?
tdata [tdata/:tmp/3: either tdata/:tmp/3 = 1[0][1]]]]
supply [
count: count + cnt
face/color: ivory
face/text: none
if even? count [face/color: ivory - 50.50.50]
face/data: false
if none? v: pick tdata count [exit]
switch/default face/style [
check [
face/data: to-logic (pick v index)
]
][face/text: pick v index]
]
sld: slider 16x400 [
c: max 0 to-integer (length? tdata) * value
if c <> cnt [cnt: c show tbl]
] return
]
]
Regards,
James.
[6/8] from: james:mustard at: 7-Dec-2001 12:56
Here is another example which uses image icons in the list/table - also it
sets the pane face colour as well as item back colours.
context [
;- The database
tdata: [
[%1.png "Adamson" "Sarah" 0]
[%2.png "Adamson" "John" 1]
[%1.png "Battey" "Nora" 0]
[%2.png "Roberts" "Julia" 1]
[%2.png "Spencer" "Frank" 1]
]
;- For the scroll bar
cnt: 0
view layout [
across
space 0
tbl: list 250x400 [across space 0 image 23x23 effect [fit] text 100 text
100 check [tmp: (face/parent-face/offset/y / face/parent-face/size/y) + 1
print face/parent-face/size if tmp <= length? tdata [tdata/:tmp/3: either
tdata/:tmp/3 = 1[0][1]]]]
supply [
count: count + cnt
face/color: ivory
face/text: none
if even? count [face/color: ivory - 50.50.50]
if not none? face/parent-face [face/parent-face/color: face/color]
face/data: false
face/image: none
if none? v: pick tdata count [exit]
switch/default face/style [
check [
face/data: to-logic (pick v index)
]
image [
face/image: load pick v index
]
][face/text: pick v index]
]
sld: slider 16x400 [
c: max 0 to-integer (length? tdata) * value
if c <> cnt [cnt: c show tbl]
] return
]
]
Regards,
James.
[7/8] from: james:mustard at: 7-Dec-2001 13:00
Sorry about leaving the debug print in the list :)
just delete the part of the list check definition that says "print
face/parent-face/size "
and it will be less annoying :)
James.
[8/8] from: arolls::idatam::com::au at: 7-Dec-2001 21:15
Andrew,
try do
http://anton.idatam.com.au/rebol/library/scroll-panel.r
Regards,
Anton.