Pointer, values in Forms? Was: Editing fields of a record in forms? - second problem
[1/4] from: yvan_iigs:gmx at: 10-Sep-2007 11:45
Hello,
I like to thank the person who told me to read the sources and to use
do-events. Unfortunately I don't remember who it was.
Now the function works but it doest something that it shouldn,t. Here again
the basic idea.
What it should do is the following:
1. I have a block a with a string in it
2. Edit-ActorRole should open a form with the value of the string in block a
and let the user edit it if he wants.
3. The edited string should be returned to block b, letting block a
untouched
Part 3 does not work
for example:
a: ["dada"]
b: Edit-ActorRole a
but the value of a is also changed and this should not be,
>> b
== [["Yvan"]] ; this is good, the value Ichanged it in the form
>> a
== ["Yvan"] ; this should not be
>>
here the code.
REBOL []
Edit-ActorRole: func [ actor-block [block!]
/local l-act-role-block
l-actor-block
]
[
l-act-role-block: copy []
; I use the copy function to be sure not to use a pointer.
l-actor-block: copy actor-block
if (l-actor-block/1 = none) [append l-actor-block ""]
Formular: view/new layout
[
text "Actor 1:" Fact1: field l-actor-block/1
button #"^M""OK"
[
l-actor-block: copy []
if not (Fact1/text = "") [append l-actor-block Fact1/text]
append/only l-act-role-block l-actor-block
unview
]
]
do-events;
return l-act-role-block
]
Mit freundlichen Gr=FCssen
Yvan =
[2/4] from: carl:cybercraft at: 10-Sep-2007 21:55
I've not the time to figure out what your function is doing, but would...
copy/deep []
fix your problem? (Without /deep the contents of the block won't be created anew.)
-- Carl Read.
On Monday, 10-September-2007 at 11:45:29 Yvan wrote,
[3/4] from: sqlab:gmx at: 10-Sep-2007 12:02
Hi Yvan,
try
l-actor-block: copy/deep actor-block
Yvan wrote:
[4/4] from: yvan_iigs:gmx at: 18-Sep-2007 16:37
Hello sqlab,
hm, yes it works that way. I just don't really understand why. I think I
have to check the source of the copy function.
Thanks
On 10.09.2007, you wrote: