TrevorBradley
Active Member
- Joined
- Nov 6, 2007
- Messages
- 732
Can someone explain why the following code doesn't work?
CODE
Program texttest;
Begin
textA();
textB();
Repeat
frame;
Until(key(_esc))
let_me_alone();
exit();
End
Process textA()
Private
String mytext;
Begin
Loop
delete_text(mytext);
mytext = write (0,10,0,0,"Text A");
frame;
End
End
Process textB()
Private
String mytext;
Begin
Loop
delete_text(mytext);
mytext = write (0,10,10,0,"Text B");
frame;
End
End
This is obviously a stripped down version of something else I'm working on.
If I run this, all I see is "Text B". It's as if the write function will only work on one process, or that somehow the TextID is global and the first process (textA) has it's text deleted by the second. In fact, if I delete the "delete_text" lines, I see both lines of text, but quickly get the 512 write lines error.
I feel like I'm doing something dumb here, but I can't see it. Help!
OK, this variant works:
CODE
Program texttest;
Begin
textA();
textB();
Repeat
delete_text(ALL_TEXT);
frame;
Until(key(_esc))
let_me_alone();
exit();
End
Process textA()
Private
String mytext;
Begin
Loop
mytext = write (0,10,0,0,"Text A");
frame;
End
End
Process textB()
Private
String mytext;
Begin
Loop
mytext = write (0,10,10,0,"Text B");
frame;
End
End
But that's crazy. A process should have some level of control over its own text and not leak out into others...
Thanks in advance...
CODE
Program texttest;
Begin
textA();
textB();
Repeat
frame;
Until(key(_esc))
let_me_alone();
exit();
End
Process textA()
Private
String mytext;
Begin
Loop
delete_text(mytext);
mytext = write (0,10,0,0,"Text A");
frame;
End
End
Process textB()
Private
String mytext;
Begin
Loop
delete_text(mytext);
mytext = write (0,10,10,0,"Text B");
frame;
End
End
This is obviously a stripped down version of something else I'm working on.
If I run this, all I see is "Text B". It's as if the write function will only work on one process, or that somehow the TextID is global and the first process (textA) has it's text deleted by the second. In fact, if I delete the "delete_text" lines, I see both lines of text, but quickly get the 512 write lines error.
I feel like I'm doing something dumb here, but I can't see it. Help!
OK, this variant works:
CODE
Program texttest;
Begin
textA();
textB();
Repeat
delete_text(ALL_TEXT);
frame;
Until(key(_esc))
let_me_alone();
exit();
End
Process textA()
Private
String mytext;
Begin
Loop
mytext = write (0,10,0,0,"Text A");
frame;
End
End
Process textB()
Private
String mytext;
Begin
Loop
mytext = write (0,10,10,0,"Text B");
frame;
End
End
But that's crazy. A process should have some level of control over its own text and not leak out into others...
Thanks in advance...