Computer Science Canada

GUI in for loop can't be clicked.

Author:  MuazS [ Thu May 31, 2018 3:20 pm ]
Post subject:  GUI in for loop can't be clicked.

What is it you are trying to achieve?
I want to make it so that the animation runs in the background and if you click the button it ends the animation and clears the screen for the game


What is the problem you are having?
I can't click my GUI button while there's a for statement in a loop.


Describe what you have tried to solve this problem
putting the "exit when GUI.ProcessEvent" everywhere.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


import GUI
View.Set ("graphics:1260;900")
var lithas : int := Font.New ("lithos pro regular:100")

procedure go
    drawfill (0, 0, maxx, maxy)
end go

var button : int := GUI.CreateButton (200, 200, 0, "Go", go)

loop
    for decreasing i : 31 .. 16
        Draw.Text ("TRON", 400, 600, lithas, i)
        delay (100)
    end for
    exit when GUI.ProcessEvent
    for a : 16 .. 31
        Draw.Text ("TRON", 400, 600, lithas, a)
        delay (100)
    end for
    exit when GUI.ProcessEvent
end loop




Please specify what version of Turing you are using
4.1.1

Author:  MuazS [ Thu May 31, 2018 5:04 pm ]
Post subject:  RE:GUI in for loop can\'t be clicked.

Nvm found a way


: