Text-view question - part II
[1/5] from: jcesar::netdados::com::br at: 9-May-2001 0:02
Hi,
I'm sorry, think I need to clarify my question! I can call the text-view.r
using tho "do" function or even include that piece of code into my script
and changing it a little bit to become a new layout definition, just like:
lo: layout [
h2 "Text File Viewer..."
...
f1: field ; file name
...
the code in the text-view.r
]
But, I' m trying to call that piece of the code with the following:
f1/text: %test.r
view lo
The layout shows up but only the f1 field is correctly filled, the other
faces (area, size, date) are still empty! Shouldn't they have been filled too?
I hope my question have been better explained.
TIA,
Julio Cesar
[2/5] from: arolls:bigpond:au at: 9-May-2001 16:42
Where are you getting %text-view.r from?
Anton.
[3/5] from: gchiu:compkarori at: 9-May-2001 20:07
On Wed, 09 May 2001 00:02:03 -0300
Júlio César Santana <[jcesar--netdados--com--br]> wrote:
> The layout shows up but only the f1 field is correctly
> filled, the other
> faces (area, size, date) are still empty! Shouldn't they
> have been filled too?
> I hope my question have been better explained.
> TIA,
I don't see how it can be done without a significant
rewrite. Perhaps someone else can.
Why not just use the view-script.r on
http://www.codeconscious.com/index.r
--
Graham Chiu
[4/5] from: gchiu:compkarori at: 9-May-2001 20:09
On Wed, 9 May 2001 16:42:39 +1000
"Anton" <[arolls--bigpond--net--au]> wrote:
> Where are you getting %text-view.r from?
>
I think it's this one.
http://www.rebol.com/library/html/text-view.html
--
Graham Chiu
[5/5] from: gjones05:mail:orion at: 9-May-2001 7:26
From: "Júlio César Santana"
> Hi,
>
> I'm sorry, think I need to clarify my question! I can call the
text-view.r
> using tho "do" function or even include that piece of code into my
script
> and changing it a little bit to become a new layout definition, just
like:
> lo: layout [
> h2 "Text File Viewer..."
<<quoted lines omitted: 7>>
> view lo
> The layout shows up but only the f1 field is correctly filled, the
other
> faces (area, size, date) are still empty! Shouldn't they have been
filled too?
> I hope my question have been better explained.
> TIA,
>
> Julio Cesar
Hi, Julio,
Now I see what you mean. And thanks to Graham for pointing out where the
text-viewer.r code is located. I modified the code to do what I think
you want.
REBOL []
size: 0x0
fix-slider: func [faces [object! block!]] [
foreach list to-block faces [
list/sld/redrag list/lc / max 1 length? head list/lines
]
]
get-file: func [a-file] [
a-file: to-file a-file
if all [not dir? a-file file? a-file] [
t0/text: a-file show t0
t1/text: sz: size? a-file show t1
t2/text: modified? a-file show t2
t3/para/origin: 4x4
t3/lines: copy []
t3/lines: either sz [read/lines a-file][none]
fix-slider t3
show t3
size: size-text t3
]
]
lo: layout [
h2 "Text File Viewer..."
box 656x4 effect [gradient 1x0 200.0.0]
across space 6
style txt text 40x24 font [valign: 'center]
txt bold "File:" t0: text 300x24
txt bold "Size:" t1: txt 60
txt bold "Date:" t2: txt 160
return space 0
t3: text-list 640x480 with [color: 0.0.200]
]
get-file %user.r
view lo
Hope this helps.
--Scott Jones
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted