Set cursor in QB45

221 Views Asked by At

I have been using the following code to change the cursor in QB45:

SUB LocateX(Inserting)
    ' locate cursor
    IF Inserting THEN
       ' half-block cursor
       Locate Xcoor, Ycoor, 1, 3, 7
    ELSE
       ' underline cursor
       Locate Xcoor, Ycoor, 1, 7, 7
    END IF
END SUB

But what I would like is a way to set the cursor color and the cursor blink rate..

Thanks for help.

1

There are 1 best solutions below

1
Sir Jo Black On BEST ANSWER

A solution exists in QB64, while in QB45 it seems to me that there are no possibilities but to use ANSI encodings (maybe in retrocomputing someone could know a possible memory address where to write the cursor color).

This solution, shown in the code below, can be valid if you intend the color code 7 dedicated to the cursor or anyway to symbols that have the same color of the cursor.

Here the code:

SCREEN 0
LOCATE 1, 1, 1, 3, 7
COLOR 15
PRINT "Cursor is gray [hit a key]"
K$ = INPUT$(1)
_PALETTECOLOR 7, &HFFDAA520 ' FF alpha makes the color translucent
PRINT "Cursor is now Goldenrod! [hit a key]"
K$ = INPUT$(1)
COLOR 7
PRINT "... also text with color 7 is Goldenrod!!! [hit a key to end]";
K$ = INPUT$(1)