[REBOL] Re: hard coded somewhere?
From: ammoncooke::yahoo at: 28-May-2001 18:33
Nope. That left me with nothing in the list! Here is the complete source
code, it is kinda long though:
REBOL[
title: "Job Giver"
Author: "Ammon Cooke"
Date: "5-21-01"
Purpose: "To randomly pass out jobs."
]
fix-slider: func [faces [object! block!]] [
foreach list to-block faces [
list/sld/redrag list/lc / max 1 length? head list/lines
]
]
creation: layout[
style lab label 100 right
;offset 100x100
across
backdrop effect [gradient 0x1 gray]
at 30x30
box 115x115 effect [gradient 2x2 50.0.12.123.53.12]
at 10x10
box 115x115 effect [gradient 2x2 200.0.0 0.0.100]
at 12x10
banner "Job Giver"
at 15x40
vh4 bold italic 125 {Random Job Giving!!}
at 100x15
lab "Jobs:" jobs: text-list 200x105 'default.txt'
at 147x35
button "Save" 50x25
at 147x65
button "Get" 50x25 [
jobfile: request-file/filter "*.jbs" /file "jobs.jbs"
file-jobs: read/lines file jobfile
foreach line file-jobs [
append jobs/data line
]
fix-slider jobs
show jobs
]
at 147x95
button "Del" 50x25 [
remove find jobs/data jobs/picked
jobs/data: head jobs/data
fix-slider jobs
show jobs
]
at 10x235
box 310x35 effect [gradient 2x2 blue]
at -50x240
lab "Jobs:" jobadd: field 200x25
at 263x240
button "Add" 50x25 [
if not jobadd/data = ""[
append jobs/data copy jobadd/data
fix-slider jobs
show jobs
]
]
at 100x125
lab "People:" ppl: text-list 200x107
at 147x145
button "Save" 50x25
at 147x175
button "Get" 50x25 [
pplfile: request-file/filter "*.ppl" /file "people.ppl"
fileppl: read/lines file pplfile
ppl/data: copy[]
foreach pplline fileppl [
append ppl/data copy pplline
]
fix-slider ppl
show ppl
]
at 147x205
button "Del" 50x25 [
remove find ppl/data ppl/picked
ppl/data: head ppl/data
fix-slider ppl
show ppl
]
at 10x275
box 323x35 effect [gradient 2x2 blue]
at -37x280
lab "People:" ppladd: field 200x25
at 275x280
button "Add" 50x25 [
if not ppladd/data = ""[
append ppl/data copy ppladd/data
fix-slider ppl
show ppl
]
]
at 400x15
lab "Generated:" gen: list 400X210 [
origin 0
across
text 200
text 200
]
at 423x35
button "Generate" 75x25 [
numjobs: jobs/text: to-integer length? jobs/data
numppl: ppl/text: to-integer length? ppl/data
data: [
[theppl thejob]
]
either numjobs <= numppl [
for i 0 numjobs 1 [
theppl: ppl/text: random/only ppl/data
thejob: jobs/text: random/only jobs/data
append gen/data copy data
remove ppl/lines theppl
;append gen/lines thejob
remove jobs/lines thejob
]
fix-slider jobs
fix-slider ppl
fix-slider gen
show jobs
show ppl
show gen
][
for i 0 numppl 1 [
theppl: ppl/text: random/only ppl/data
thejob: jobs/text: random/only jobs/data
append gen/lines copy theppl
remove ppl/lines theppl
append gen/lines copy thejob
remove jobs/lines thejob
]
fix-slider jobs
fix-slider ppl
fix-slider gen
show jobs
show ppl
show gen
]
]
at 423x65
button "Multi-Gen" 75x25
at 423x95
button "Print" 75x25
at 423x125
button "Save" 75x25
]
view/offset: creation 100x100
Thanks!!
Ammon