Documentation of the module cio

by Peter Verhas

Table of Contents

[Contents]

1. Introduction

Console handling low level routines for Win32 environment.

This module implements routines that can handle the Windows character console on low level. This is like getting a character without echo, or checking that a key was pressed without stopping the program, disabling control-c and so on.

[Contents]

2. cio::GotoXY(x,y)

Position the console cursor at the coordinate (X,Y). The next PRINT statement sending characters to the screen will print to this position.

[Contents]

3. cio::KbHit()

Returns TRUE if there is any keyboard pressed and waiting in the keyboard buffer and returns FALSE if there is no key in the keyboard buffer.

[Contents]

4. cio::GetCh()

Get a single character from the keyboard buffer without echo. If there is no key pressed in the keyboard buffer then the function waits for the user to press a key.

[Contents]

5. cio::GetChE()

Get a single character from the keyboard buffer with echo. If there is no key pressed in the keyboard buffer then the function waits for the user to press a key.

[Contents]

6. cio::Detach()

Close the console window. There is no way to open a new console after it has been closed. If the program was started from the command line it does not close the console window, but further print commands go into nowhere.

[Contents]

7. cio::GetTitle()

The function returns the title text of the console window.

[Contents]

8. cio::SetTitle()

Set the title of the console window.

[Contents]

9. cio::NoBreak()

After calling this function the ScriptBasic interpreter will ignore the user pressing control-c.

[Contents]

10. cio::Break()

After calling this function if the user presses control-c the program terminates. This is the default behaviour. This function should be used to return to the default behaviour after calling nobreak.

[Contents]

11. cio::BufferSizeX

This function returns the console buffer horizontal size.

The console buffer is the character buffer that holds all characters that are visible on the console or that can be scrolled to the console using the scroll bar.

[Contents]

12. cio::BufferSizeY

This function returns the console buffer vertical size.

The console buffer is the character buffer that holds all characters that are visible on the console or that can be scrolled to the console using the scroll bar.

[Contents]

13. cio::CursorX

Get the actual cursor position. The function returns the horizontal position of the console cursor.

[Contents]

14. cio::CursorY

Get the actual cursor position. The function returns the vertical position of the console cursor.

[Contents]

15. cio::SizeX

This function returns the horizontal size of the console window in terms of characters.

[Contents]

16. cio::SizeY

This function returns the vertical size of the console window in terms of characters.

[Contents]

17. cio::PossibleMaxX

This function returns the possible maximal horizontal size of the console that could fit on the screen using the actual character set and screen resolution.

[Contents]

18. cio::PossibleMaxY

This function returns the possible maximal vertical size of the console that could fit on the screen using the actual character set and screen resolution.

[Contents]

19. cio::SetWindow

This function is supposed to set the actual size of the console. However this does not work properly and I do not know why.

[Contents]

20. cio::SetCursor

Use this subroutine to set the cursor size. The argument value gives the percentages of the height of the cursor relative to the total character tallness.

[Contents]

21. cio::SetColor col

The the color of the consecutive printings or clear screeen cls.

The argument should be an integer value defining the actual color. To create this value the constants defined in cio.bas should be used. These are:

To set the actual color of the foreground and the background the programmer may use and expression that or connects these values. For example

cio::SetColor FBlue or BIntense

sets the foreground blue and the backgound black with intense bit set (a kind of light grey). To get the actual colors play a bit with the sample program testconcol.bas in the directory examples.

To ease different color settings the header file cio.bas defines the following constants:

[Contents]

22. cio::Cls

Clear the console screen and set all character cells to the last color settings. See also color.