Part 5 - The Clear Screen Function
After learning in Part 4 that you need to clear the screen you will
be wondering what the code you need is, well don't worry it is still
very easy!! Take a look:
CLS
PRINT "Hello!!"
This is the Clear Screen Function, it is simply "cls"
This will clear the screen back to blank everytime you run a program.
So you don't have your last program still on the screen. Easy isn't
it!! You will need to put it on the first line of your program, so that
it will clear the screen before doing the next operation!!!
Part 6 - Screens
QBasic has different screen modes depending on what you want to do!! Each screen mode
has a different resolution for your text, and pictures!!
Screen 0 is the default screen. So if you don't assign a screen then qbasic will use
this one!! Screen 1 gives you really big text
Screen 2 gives you a slightly bigger than screen 0 with an italic type of text
etc
There are 13 screens for you to try out!!
How to use the screen statement:
CLS
SCREEN 9
PRINT "hi"
By using this code you will see the difference which the screens make, to change the
screen mode just change the number after the screen function. Just remember that you can
use 0-13.
Part 7 - Color
So far what we have done has all been in plain black and white so why don't we spice it up a
bit!! By using the color statement!! The color statement is just as easy as the other functions,
and can be used for you to use different colors on your programs!!
- color 0 - gives you black writing ( * note the screen will be blank because the writing and
background colors are the same!!)
- color 1 - gives you blue writing
- color 2 - gives you a pretty green color
etc
There are up to 17 normal colors (0 - 16)!! From color 17 - 30 you can get flashing colored
text!! However some screens do not support flashing text eg screen 9
To write in a red color the code is :
Screen 0 has been chosen as it is a normal screen which supports flashing text!!
CLS
SCREEN 0
COLOR 12
PRINT "hi"
This shows hi in a red font!!
To write in a flashing red font :
CLS
SCREEN 0
COLOR 28
PRINT "hi"
As you can see this shows "hi" in a red flashing text!!