[ALLY] Found the reason for "disappearing text"
[1/4] from: peoyli::algonet::se at: 14-Nov-2000 23:46
Hi,
I recently found out what was causing my (am I the only one who got
this problem ?) texts in some layouts to disappear..
Setting the para/origin/x and para/origin/y values of at least a text
face (ie scrolling) affects every other object's para/origin values.
Now.. What can be done to stop this from happening ?
Is this a feature or a bug ?
/PeO
A small example to play around with:
;-
REBOL [
Title: "ViewTest"
Version: 0.0.3
Author: "PeO"
File: %viewtest.r
Email: [peoyli--algonet--se]
Purpose: {Just to test something}
Comment: {
Current problem:
Every face's para/origin/y and para/origin/x values is affected when
changing one of them.
The action block of the "+y" "-y" "+x" "-x" updates the affected faces
to make the bug more visible.
Remove the action blocks, and try hovering over the buttons down below,
and notice that the text has moved..
Bug or a feature ?
The problems exists at least on the Amiga and Solaris versions of View
0.10.38
}
]
appname: "ViewBug 0.0.3"
fsize: 14
tboxlines: 10
tboxwidth: 500
tboxsize: to-pair rejoin [tboxwidth "x" tboxlines * fsize]
iboxsize: to-pair rejoin [tboxsize/x "x" fsize + 9]
fontspec: [
color: 0.255.0
shadow: none
size: fsize
]
;---------------------------- Main layout ------------------------
main: layout [
backdrop 70.0.100
origin 10x15
at 10x10 ti1: title appname
at 10x30 te1: text "Is this a bug or a feature, and how do I get rid of that feature
?"
at 10x50
text-face: text tboxsize with [
para/origin/y: 0
text: rejoin ["Welcome to " appname]
color: 0.0.0 font: fontspec
]
across space 1
b1: button to-pair reduce [text-face/size/x - 200 24] "Text moves when text-face's origin
is changed"
button 50x24 "+y" [text-face/para/origin/y: text-face/para/origin/y + 5 show text-face
show b1 show ti1 show te1]
button 50x24 "-y" [text-face/para/origin/y: text-face/para/origin/y - 5 show text-face
show b1 show ti1 show te1]
button 50x24 "+x" [text-face/para/origin/x: text-face/para/origin/x + 5 show text-face
show b1 show ti1 show te1]
button 50x24 "-x" [text-face/para/origin/x: text-face/para/origin/x - 5 show text-face
show b1 show ti1 show te1]
]
;---------------------------- Display GUI ------------------------
view/title/offset main appname 500x500
[2/4] from: petr:krenzelok:trz:cz at: 15-Nov-2000 1:15
----- Original Message -----
From: P-O Yliniemi <[peoyli--algonet--se]>
To: <[ally-list--rebol--com]>
Cc: <[feedback--rebol--com]>
Sent: Tuesday, November 14, 2000 11:46 PM
Subject: [ALLY] Found the reason for "disappearing text"
> Hi,
Hi :-)
> I recently found out what was causing my (am I the only one who got
> this problem ?) texts in some layouts to disappear..
>
> Setting the para/origin/x and para/origin/y values of at least a text
> face (ie scrolling) affects every other object's para/origin values.
>
> Now.. What can be done to stop this from happening ?
>
> Is this a feature or a bug ?
It's REBOL "feature" :-) You can yourself so much of a confusion remembering
fact nested objects are shared thru all "childs". I don't remember already
the explanation of RT why it is so in REBOL. I thought language should be
some kind of balance between technology and practical usability .... so
far - subobject sharing is causing nothing but problems ...
Try to use any of already suggested methods for object (deep objects)
copying:
I use the form:
saved-feel: make system/standard/face/feel []
stylize: [
txt text with [feel: make saved-feel []]
]
This way you can be sure you will have feel subobject of text face, which
will not be shared by other text faces ...
However - there seem to be some problem with 'stylize or so, as I tried to
define saved-edge for e.g., but I can't use similar aproach as in above
example - I found out there is difference if the word you want to define is
exposed to dialect level, e.g.:
stylize: [
img: image with [edge: make edge [size: 2x2 color: red]]
img2: image edge [size: 2x2 color: red]
]
If you will use first line - all styles will have edge of 2x2, in red color
... If you will use second line - only img2 will have changed edge style ...
the result should be identical imho ...
So I would suggest you not to use 'with, if you can use facet word directly
in dialect .... the stuff will not get shared that way ...
try to use following code in your script:
text-face: text tboxsize para [origin/y: 0] with [
text: rejoin ["Welcome to " appname]
color: 0.0.0 font: fontspec
]
does it work for you?
PS: I would like RT to confirm it's/isn't a bug ...
-pekr-
[3/4] from: peoyli:algonet:se at: 15-Nov-2000 2:38
> So I would suggest you not to use 'with, if you can use facet word directly
> in dialect .... the stuff will not get shared that way ...
<<quoted lines omitted: 4>>
> ]
> does it work for you?
In this particular case, it worked, but if I try to omit the para word
for the text-face, the title will scroll together with the text
again..
This 'feature' is reconstructable in a lot of example programs in the
'library' from RT, take for example text-view.r by Carl..
Change the subtitle to be accessible by for example the "st1" word
like:
view layout [
st1: subtitle "Text File Viewer..."
...
and add
show st1
in the slider's action block, and you'll get a scrolling title (that
is more easy to detect than not including 'show st1' in the slider's
action). It isn't the 'show.. line that scrolls the title, it will
just be updated a bit easier (it may be updated by randomly clicking
on it or any other object, therefor the randomly jumping text effect).
/PeO
[4/4] from: agem:crosswinds at: 15-Nov-2000 6:14
somewhere is a 'scroll or that instead of 'origin?
Volker
[peoyli--algonet--se] wrote on 15-Nov-2000/6:12:42+1:00
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted