Computer Science Canada cls doesnt work after end loop!!! |
Author: | Bubka [ Sat Nov 15, 2008 10:00 am ] | ||
Post subject: | cls doesnt work after end loop!!! | ||
I have buttons in my code and a loop after them in order for them to work. After end loop the cls does not clear the screen in order to allow the rest of the program to be displayed. I am new to Turing so I don't know what is wrong. Please help, thank you in advance.
|
Author: | pavol [ Sat Nov 15, 2008 11:10 am ] |
Post subject: | Re: cls doesnt work after end loop!!! |
To clear GUI components off the screen you have to use the following code, not cls. GUI.Dispose(objectName). For example, GUI.Dispose(question1Button1) |
Author: | Bubka [ Sat Nov 15, 2008 11:26 am ] | ||||
Post subject: | Re: cls doesnt work after end loop!!! | ||||
I just tried that but it's still not working. Once i click the button the message is displayed and it just remains there. I need it to remain there for a couple seconds or so and then continue with the rest of the code.
the above is what i typed based on your advice after the screen clears, i want this displayed:
Please help if you can. Thanks |
Author: | pavol [ Sat Nov 15, 2008 12:09 pm ] |
Post subject: | RE:cls doesnt work after end loop!!! |
Can you post the rest of your code please? and what seems to be the problem exactly? maybe its just me but i don't see what's going on. if you want things to pause you can use the delay() function. Just call delay(time), time being in milliseconds. |
Author: | CodeMonkey2000 [ Sat Nov 15, 2008 1:00 pm ] |
Post subject: | RE:cls doesnt work after end loop!!! |
exit when GUI.ProcessEvent doesn't exit out of the loop. It runs that function, and it returns false. |
Author: | Bubka [ Sat Nov 15, 2008 1:45 pm ] | ||
Post subject: | Re: cls doesnt work after end loop!!! | ||
here is the rest of my code. basically the program is supposed to be a multiple choice math quiz. After the first question ends, i have buttons as the choices to go with it. The problem begins after the first question is answered. It is supposed to clear the screen, then display the second question.
|
Author: | ecookman [ Sat Nov 15, 2008 5:45 pm ] |
Post subject: | RE:cls doesnt work after end loop!!! |
try putting it at the end of the lines so where it says something like this %Create procedures for question 1. procedure right1 cls drawfillbox (0, 0, 639, 399, blue) drawfillbox (10, 10, 629, 389, white) Font.Draw ("You're Right!!!", 65, 200, font1, blue) end right1 procedure question1Choice1 cls make it %Create procedures for question 1. procedure right1 cls drawfillbox (0, 0, 639, 399, blue) drawfillbox (10, 10, 629, 389, white) Font.Draw ("You're Right!!!", 65, 200, font1, blue) cls end right1 procedure question1Choice1 |
Author: | Bubka [ Sun Nov 16, 2008 9:50 am ] |
Post subject: | Re: cls doesnt work after end loop!!! |
thanks that works for the clear screen however the rest of the code still doesnt display for some reason |
Author: | andrew. [ Sun Nov 16, 2008 2:18 pm ] | ||
Post subject: | RE:cls doesnt work after end loop!!! | ||
It doesn't work because when you use exit when GUI.ProcessEvent, that is always false so the loop never exits. You have to make it exit with another argument. Maybe have a variable called answered and make that true when the question is answered.
|
Author: | Bubka [ Mon Nov 17, 2008 9:39 am ] |
Post subject: | RE:cls doesnt work after end loop!!! |
thanks andrew |