Computer Science Canada

Flickering Screen

Author:  Jas [ Sat May 14, 2005 5:11 pm ]
Post subject:  Flickering Screen

I am using the cls command in a loop, and evertime it goes through the loop, it makes the screen flicker. Here is my program:

code:

import GUI

procedure List
cls
put "NAME                           ADDRESS"
    var a : string (1)
    put "press any key to continue"
    getch (a)
end List

procedure BILL
cls
put "Enter account number: "
    var a : string (1)
    put "press any key to continue"
    getch (a)
end BILL

procedure QuitPressed
    GUI.Quit
end QuitPressed



loop

var button1, button2, button3 : int

put "Choose one of the following:"
button1 := GUI.CreateButtonFull (100, 150, 2, "List All Customers",
    List, 50, GUI.NONE, false)
button2 := GUI.CreateButtonFull (250, 150, 2, "Choose Specific Custoer",
    BILL, 50, GUI.NONE, false)

button3 := GUI.CreateButtonFull (430, 150, 110, "Quit", QuitPressed, 50, GUI.NONE, false)

exit when GUI.ProcessEvent

GUI.Refresh
cls

end loop


First i had to get past the GUI.ProcessEvent problem, and when i did that, i got the flickering screen problem. GUI.Refresh helped, but the screen still flickered a little. is there a way to prevent this? (These are not my actual procedures, because my real ones are too long and involve inputting data files)

Author:  Delos [ Sat May 14, 2005 5:56 pm ]
Post subject: 

Look for and read the tutorial dealing with View.Update() and 'offscreenonly'.

Author:  Jas [ Sat May 14, 2005 9:07 pm ]
Post subject: 

i tried looking for the tutorial using the search option at the top, but all i got was programs from other users which had "setscreen("offscreenonly") and View.Update commands in them. I couldn't find a tutorial on it. can u tell me where the totorial is, if there is any?

Author:  Cervantes [ Sun May 15, 2005 7:43 am ]
Post subject: 

http://www.compsci.ca/v2/viewtopic.php?t=193
http://www.compsci.ca/v2/viewtopic.php?t=3077

It's really easy. Just set it to offscreenonly, then View.Update after you've drawn everything in your main loop. Be careful, though. You don't want to have more than one View.Update, as that totally defeats the purpose. (And it slows the program down!)


: