Computer Science Canada Turing Chat Program |
Author: | 1kd7 [ Mon Dec 01, 2014 2:20 pm ] | ||||
Post subject: | Turing Chat Program | ||||
What is it you are trying to achieve? I am trying to make a Chat program that can be added to other programs but it keeps stopping when I try to type something in the ChatEnter text Field. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Also its not the Network code thats wrong because this doesn't work either.
Please specify what version of Turing you are using 4.1 |
Author: | DemonWasp [ Mon Dec 01, 2014 10:31 pm ] |
Post subject: | RE:Turing Chat Program |
This one is kind of interesting. I found that if you remove the text box entirely (comment out its creation) then your program 'works' -- in that it doesn't immediately crash. I didn't test the rest of the program. I used Turing 4.10 for this investigation (it says Turing 4.1 in the help window). As far as I can tell, you're running into a bug in Turing's implementation of text fields. The technical description is: the TextBox class (in TextBoxClass.tu) fails to implement ConsiderKeystroke(ch : char). Other classes, like TextField, implement that method just fine. That means that when you press a key, Turing goes through all of the widgets and asks them if they want that keystroke or not -- if they do, then they get asked to process it; if not, then it gets offered to the next widget in sequence. As an interesting consequence of that implementation, you can work around this bug by making sure you create the text field last. If you just reverse the order of initialization, I think your program works fine. This programming practice isn't great, because it's a silly workaround to an underlying problem, but it's also (unfortunately) not likely to ever be fixed. As a side note, it is curious that Turing lets you declare a deferred procedure and then not implement it. |