[REBOL] text-list-cover-up.r
From: jfdutcher1958::yahoo::com at: 5-Apr-2006 19:09
I offer the following script 'adapted' after
considerable effort fom the original subject line
script authored very admirably by R.v.d.Zee.
Mr Zee makes a 'comment' in the script that hi-liting
any line in a text-list (including the one at hand)
hi-lites any and all duplicates in such a list.
In my case this is especially offensive because the
middle initial column has so many 'space' entries
which
are duplicates.
I just wondered if anyone can see a way to make the
'hilites' function hilite exactly one horizontal row
??
*******************************************************
Rebol[Title: "sortresidents"
Author: "R.v.d.Zee"
Owner: "R.v.d.Zee"
Rights: {Copyright (C) R.v.d.Zee 2006}
Notes: {
Overlapping text-lists are used to create the
impression of a single text-list.
The scroll bar of the last text list is covered by a
scroller.
The colors of the new scroller may easily be set.
Column & font colors and other facets may also be
easily changed.
As with all text-lists, all duplicated items in a
text-list will be highlighted.
}
]
port: open/seek %/c/vetssrc/dietsys/dsysmst.txt
read-record: func [port record-size record-number] [
copy/part at port record-number - 1 * record-size +
1 record-size
]
substr: func [record offset len] [
copy/part at record offset len
]
repeat i 299 [
rec1: read-record port 2690 i
sortBlock: []
y: 1
regnbr: substr rec1 y + 3 4
lname: substr rec1 y + 7 15
fname: substr rec1 y + 22 15
minit: substr rec1 y + 37 1
if (regnbr <> "XXXX") [
repend/only sortBlock [lname fname mold minit
regnbr]
]
]
listData: sort sortBlock
dataLength: length? listData
lnameData: make block! dataLength
fnameData: make block! dataLength
minitData: make block! dataLength
regnbrData: make block! dataLength
forskip listData 1 [
append lnameData pick listData/1 1
append fnameData pick listData/1 2
append minitData pick listData/1 3
append regnbrData pick listData/1 4
]
hiLites: func [data picked][
pickPoint: (length? data) - (length? find/only
data picked) + 1
lname/picked: to-block mold pick lnameData
pickPoint
fname/picked: to-block mold pick fnameData
pickPoint
minit/picked: to-block mold pick minitData
pickPoint
regnbr/picked: to-block pick regnbrData
pickPoint
show [lname fname minit regnbr]
listData: skip listData pickPoint - 1
oneLine/text: rejoin [pick listData/1 1 " "
pick listData/1 2 " " pick listData/1 3 " " pick
listData/1 4]
show oneLine
listData: head listData
]
coverUp: layout [
backcolor 183.99.0
across
space 0
style labels label font-color coffee
indent 1 labels "Last Name"
indent 118 labels "First Name"
indent 122 labels "Mid Init"
indent 30 labels "Reg Number"
return
style lists text-list coffee olive font-size 14
[
hiLites face/data face/picked/1
]
lname: lists 200x404 gold olive -
10 data lnameData
indent -16 fname: lists 200x404 coffee - 50
olive data fnameData
indent -16 minit: lists 100x404 coffee - 50
olive - 10 data minitData center
indent -16 regnbr: lists 100x404 0.0.105
olive data regnbrData
indent -16 scrollAll: scroller 16x404 brown + 50
brown [
lname/sn: fname/sn: minit/sn: regnbr/sn: round
scrollAll/data * (length? listData)
show [lname fname minit regnbr]
]
return
oneLine: field water water 536x30 font-size 17
center
return
btn "Quit" gold [quit]
]
;minit/iter/para/indent: regnbr/iter/para/indent: 10x2
;lname/iter/para/indent: 20x2
scrollAll/speed: 20 ;the default is 20, this may
speed up the scrolling of the text-lists
view coverUp