C Language Development Kit/Functions/Cursor

From OptiWiki

Jump to: navigation, search
Description This function controls the appearance of the cursor and how text is wrapped

at the end of the line. On top of that, it controls the visibility of the indicators on the PHL1300.

Syntax
void cursor(int mode);
Arguments
int mode
mode can have one of the following values:
OFF No cursor will be visible
BLINKING The cursor will be a blinking underscore on the PHL, or a blinking block on the DWT7133.
ON The cursor will be a constantly visible underscore.
AUTOWRAP Text is wrapped to the next line, when the end of the line is reached.
NOWRAP Text is not wrapped to the next line. Text beyond the end of the line will not be visible.
NOICONS (PHL1300 only) The battery and backup battery icons at the bottom of the screen, will not be visible after a call to cursor() with this argument.
DOICONS (PHL1300 only) The icons will reappear.
Returns None
Remarks On the PHL the cursor can be off, a fixed underscore or a blinking underscore.

the cursor can be off, a fixed underscore or a blinking 'block'. Constants cannot be 'or'red, so when you want to switch the cursor ON, and enable the AUTOWRAP option, you have to make two calls to cursor().

Example
#include "lib.h"
#include <stdio.h>
 
void main( void )
{
    int c;
 
    cursor( ON );
    printf("\fCursor example");
 
    while( 1 )
    {
        if( ( c = getchar()) != EOF )
        {
            switch( c )
            {
            #if PHL_TERMINAL|OPH
                case F1_KEY:
                    cursor( OFF );
                    break;
                case F2_KEY:
                    cursor( ON );
                    break;
                case F3_KEY:
                    cursor( BLINKING );
                    break;
            #else
                case ENT_KEY:
                    cursor( OFF );
                    break;
                case UP_KEY:
                    cursor( ON );
                    break;
                case DOWN_KEY:
                    cursor( BLINKING );
                    break;
            #endif
                default:
                    gotoxy( 0, 1);
                    printsymbol( c );
                    break;
            }
        }
        idle();
    }
}


Views
Personal tools