Keyboard Input


Defines

#define KEY_SECTION1   0x100
#define KEY_SECTION2   0x101
#define KEY_SECTION3   0x102
#define KEY_SECTION4   0x103
#define KEY_SECTION5   0x104
#define KEY_SECTION6   0x105
#define KEY_SECTION7   0x106
#define KEY_ESC   0x107
#define KEY_LEFT   0x108
#define KEY_UP   0x109
#define KEY_RIGHT   0x10A
#define KEY_DOWN   0x10B
#define KEY_INS   0x10C
#define KEY_DEL   0x10D
#define KEY_TAB   0x10E
#define KEY_SELECT   0x10F
#define KEY_ENTER   0x110
#define KEY_BACKSPACE   0x111
#define KEY_HELP   0x112
#define KEY_SHIFT   0x113
#define KEY_CONTROL   0x114
#define KEY_CY   133
#define KEY_SPACE   0x20
#define KEY_0   0x30
#define KEY_1   0x31
#define KEY_2   0x32
#define KEY_3   0x33
#define KEY_4   0x34
#define KEY_5   0x35
#define KEY_6   0x36
#define KEY_7   0x37
#define KEY_8   0x38
#define KEY_9   0x39
#define KEY_QUOTE   0x27
#define KEY_COMMA   0x2C
#define KEY_MINUS   0x2D
#define KEY_PERIOD   0x2E
#define KEY_SLASH   0x2F
#define KEY_SEMICOLON   0x3B
#define KEY_BACKSLASH   0x5C
#define KEY_EQUAL   0x3D
#define KEY_OPEN_SBRACKET   0x5B
#define KEY_CLOSE_SBRACKET   0x5D
#define KEY_BACKQUOTE   0x60
#define KEY_A   0x61
#define KEY_B   0x62
#define KEY_C   0x63
#define KEY_D   0x64
#define KEY_E   0x65
#define KEY_F   0x66
#define KEY_G   0x67
#define KEY_H   0x68
#define KEY_I   0x69
#define KEY_J   0x6A
#define KEY_K   0x6B
#define KEY_L   0x6C
#define KEY_M   0x6D
#define KEY_N   0x6E
#define KEY_O   0x6F
#define KEY_P   0x70
#define KEY_Q   0x71
#define KEY_R   0x72
#define KEY_S   0x73
#define KEY_T   0x74
#define KEY_U   0x75
#define KEY_V   0x76
#define KEY_W   0x77
#define KEY_X   0x78
#define KEY_Y   0x79
#define KEY_Z   0x7A

Typedefs

typedef int click_kind_t

Functions

bool get_clicks_enabled (void)
void set_clicks_enabled (bool enable)
void disable_key_click (int *ptr_key_list, int key_count)
time_t last_key_time (void)
click_kind_t get_click_kind (void)
void set_click_kind (click_kind_t kind)
bool is_sticking_keys_enabled (void)
void enable_sticking_keys (bool enable)
bool enable_function_keys (bool enable)


Compounds

     struct   DirectKeyboardA DirectKeyboard object scans the Cybiko computer's keyboard to determine what keys the user has pressed


Detailed Description

Some structures, functions and defines for work with keyboard. We recommend that you look at DirectKeyboard structure. It's more difficult, but it's a more effective way to handle keyboard input (the easy way is to just process respective Message's).


Define Documentation

#define KEY_0   0x30
 

0 key.

#define KEY_1   0x31
 

1 key.

#define KEY_2   0x32
 

2 key.

#define KEY_3   0x33
 

3 key.

#define KEY_4   0x34
 

4 key.

#define KEY_5   0x35
 

5 key.

#define KEY_6   0x36
 

6 key.

#define KEY_7   0x37
 

7 key.

#define KEY_8   0x38
 

8 key.

#define KEY_9   0x39
 

9 key.

#define KEY_A   0x61
 

A key.

#define KEY_B   0x62
 

B key.

#define KEY_BACKQUOTE   0x60
 

` key.

#define KEY_BACKSLASH   0x5C
 

\ key.

#define KEY_BACKSPACE   0x111
 

Backspace, move left and delete.

#define KEY_C   0x63
 

C key.

#define KEY_CLOSE_SBRACKET   0x5D
 

] key.

#define KEY_COMMA   0x2C
 

, key.

#define KEY_CONTROL   0x114
 

Fn ( "alternative function" ) key.

#define KEY_CY   133
 

CY sign (Fn+C).

#define KEY_D   0x64
 

D key.

#define KEY_DEL   0x10D
 

Delete/No, 2-nd big key.

#define KEY_DOWN   0x10B
 

Down ( joystick, arrow key ).

#define KEY_E   0x65
 

E key.

#define KEY_ENTER   0x110
 

Enter, 5-th big key.

#define KEY_EQUAL   0x3D
 

= key.

#define KEY_ESC   0x107
 

Escape/Backspace ( upper left corner ).

#define KEY_F   0x66
 

F key.

#define KEY_G   0x67
 

G key.

#define KEY_H   0x68
 

H key.

#define KEY_HELP   0x112
 

Help key, in the upper-left corner of the case.

#define KEY_I   0x69
 

I key.

#define KEY_INS   0x10C
 

Insert/Yes, 1-st big key.

#define KEY_J   0x6A
 

J key.

#define KEY_K   0x6B
 

K key.

#define KEY_L   0x6C
 

L key.

#define KEY_LEFT   0x108
 

Left ( joystick, arrow key ).

#define KEY_M   0x6D
 

M key.

#define KEY_MINUS   0x2D
 

"-" key.

#define KEY_N   0x6E
 

N key.

#define KEY_O   0x6F
 

O key.

#define KEY_OPEN_SBRACKET   0x5B
 

[ key.

#define KEY_P   0x70
 

P key.

#define KEY_PERIOD   0x2E
 

"." key.

#define KEY_Q   0x71
 

Q key.

#define KEY_QUOTE   0x27
 

' key.

#define KEY_R   0x72
 

R key.

#define KEY_RIGHT   0x10A
 

Right ( joystick, arrow key ).

#define KEY_S   0x73
 

S key.

#define KEY_SECTION1   0x100
 

Hot key for section Main Menu.

#define KEY_SECTION2   0x101
 

Hot key for section Chat.

#define KEY_SECTION3   0x102
 

Hot key for section People.

#define KEY_SECTION4   0x103
 

Hot key for section Applications.

#define KEY_SECTION5   0x104
 

Hot key for section Games.

#define KEY_SECTION6   0x105
 

Hot key for section Labyrinth.

#define KEY_SECTION7   0x106
 

Hot key for section CyLandia.

#define KEY_SELECT   0x10F
 

Select, 4-th big key.

#define KEY_SEMICOLON   0x3B
 

; key.

#define KEY_SHIFT   0x113
 

Shift ( "upper case" ) key.

#define KEY_SLASH   0x2F
 

/ key.

#define KEY_SPACE   0x20
 

Space key.

#define KEY_T   0x74
 

T key.

#define KEY_TAB   0x10E
 

Tab/Switch, 3-rd big key.

#define KEY_U   0x75
 

U key.

#define KEY_UP   0x109
 

Up ( joystick, arrow key ).

#define KEY_V   0x76
 

V key.

#define KEY_W   0x77
 

W key.

#define KEY_X   0x78
 

X key.

#define KEY_Y   0x79
 

Y key.

#define KEY_Z   0x7A
 

Z key.


Typedef Documentation

typedef int click_kind_t
 

Keyboard click sound.
Must be one of the following: CK_NO, CK_BEEP_SHORT or CK_BEEP_SHORT.

See also:
CK_NO, CK_BEEP_SHORT, CK_BEEP_SHORT.


Function Documentation

void disable_key_click ( int * ptr_key_list,
int key_count )
 

Disables the click sound for the keys specified, enables the click sound for the rest keys.
To enable the click sound for all the keys, call disable_key_click() with key_list and key_count set to 0.

Parameters:
ptr_key_list   an array of keys virtual codes.
key_count   the number of elements in this array.
Returns:
None.
       #include <cybiko.h>
       ...
       static const int arrows_keys[4] = { 
                                           KEY_UP, 
                                           KEY_DOWN, 
                                           KEY_LEFT, 
                                           KEY_RIGHT
                                         };
       ...
       // Disables the click sound for the arrows keys.
       disable_key_click( arrows_keys, 4 );
       ...

bool enable_function_keys ( bool enable )
 

Enables or disables function key processing.

Parameters:
enable   if TRUE enables function key processing, else disables ones.
Returns:
Previous state.
       #include <cybiko.h>
       ...
       bool function_keys;
       ...
       //  Disables key function processing.  
       function_keys = enable_function_keys(FALSE);
       ...
       //  Restores key function processing state. 
       enable_function_keys(function_keys);
       ...  

void enable_sticking_keys ( bool enable )
 

Enables or disables "sticking keys" option.

Parameters:
enable   if TRUE, "sticking keys" option is enabled, else "sticking keys" option is disabled.
Returns:
None.
       #include <cybiko.h>
       ...
       if ( !is_sticking_keys_enabled() )
          enable_sticking_keys( TRUE );
See also:
is_sticking_keys_enabled.

click_kind_t get_click_kind ( void )
 

Returns current kind of click sound.

Returns:
The current kind of click sound.
       #include <cybiko.h>
       ...
       click_kind_t click_type;
       ...
       click_type = get_click_kind();
       // 'click_type' might have parameters as follows: CK_BEEP_SHORT, CK_BEEP, CK_NO.
       if ( click_type != CK_BEEP_SHORT )
            set_click_kind( CK_BEEP_SHORT );
       ...
See also:
set_click_kind, CK_BEEP_SHORT, CK_BEEP, CK_NO.

bool get_clicks_enabled ( void )
 

Returns state of a key clicks prohibition.

Returns:
TRUE if the key click is not prohibited.
       #include <cybiko.h>
       ...
       bool clicks_enabled;
       ...
       clicks_enabled = get_clicks_enabled();
       // Turns off the keys clicks.
       set_clicks_enabled( FALSE );
       ...
       // Restors the keys clicks.
       set_clicks_enabled( clicks_enabled );
See also:
set_clicks_enabled.

bool is_sticking_keys_enabled ( void )
 

Returns TRUE if "sticking keys" option is enabled.

Returns:
TRUE if "sticking keys" option is enabled.
       #include <cybiko.h>
       ...
       if ( !is_sticking_keys_enabled() )
          enable_sticking_keys( TRUE );
See also:
enable_sticking_keys.

time_t last_key_time ( void )
 

Returns the time (in the time_t format) of the last keystroke.

Returns:
The last keystroke time.
       #include <cybiko.h>
       ...
       struct Time time;
       ...
       Time_decode( &time, last_key_time() );
       TRACE("Last key was pressed at hour: %d, minutes: %d, seconds: %d",
              time.hour, time.minute, time.second );
       ...

void set_click_kind ( click_kind_t kind )
 

Sets current kind of click sound.

Parameters:
kind   must be one of the following: CK_NO, CK_BEEP, or CK_BEEP_SHORT.
Returns:
None.
       #include <cybiko.h>
       ...
       click_kind_t click_type;
       ...
       click_type = get_click_kind();
       // 'click_type' might have parameters as follows: CK_BEEP_SHORT, CK_BEEP, CK_NO.
       if ( click_type != CK_BEEP_SHORT )
            set_click_kind( CK_BEEP_SHORT );
       ...
See also:
get_click_kind, CK_BEEP_SHORT, CK_BEEP, CK_NO.

void set_clicks_enabled ( bool enable )
 

Disables or enables keyboard clicks.

Parameters:
enable   if TRUE enables all keyboard clicks, else disables keyboard clicks in accordance to procedure disable_key_click().
Returns:
None.
       #include <cybiko.h>
       ...
       bool clicks_enabled;
       ...
       clicks_enabled = get_clicks_enabled();
       // Turns off the keys clicks.
       set_clicks_enabled( FALSE );
       ...
       // Restors the keys clicks.
       set_clicks_enabled( clicks_enabled );
See also:
get_clicks_enabled.