turning the cursor off

DOS specific questions.
Post Reply
nedman47
Posts: 62
Joined: Dec 05, 2006 15:35

turning the cursor off

Post by nedman47 »

i'm developing a program that puts a menu of items on the screen and provides its own block cursor, so it begins by clearing the screen and turning off the cursor with LOCATE ,,0.

i noticed that the cursor did not always turn off. upon further investigation i found that it turns off the cursor the first time i run it but on subsequent runs, the cursor remains on. if i run a different program in between, it works again, once.

i later discovered that this happens even if you use ASM and manipulate the cursor with INT 16. two programs that call INT 16 with different values in the registers work if run alternatively, but neither works twice in a row.

this may not be a freebasic issue but it sure is odd.

asm
mov ah,1
mov cx,0x20
int 0x10
end asm

i am using freebasic dos 0.17 and windows xp
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Post by DrV »

You should generally restore the cursor to be visible when the program ends (Locate ,,1); maybe this will have some effect. Otherwise, I'll see if I can reproduce this here.
nedman47
Posts: 62
Joined: Dec 05, 2006 15:35

Post by nedman47 »

locate ,,1 has no effect.

here is a complete program that shows the problem. the first time you run it, the cursor is off. on subsequent runs, the cursor remains on.

Code: Select all

locate ,,0
cls
locate 10,15
print "hello world"
dim k as integer
k = getkey
locate ,,1
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Post by DrV »

I can reproduce this on Windows XP - apparently it doesn't happen on real DOS or Windows 9x, but I'll see if I can find out why it happens or at least work around it.
nedman47
Posts: 62
Joined: Dec 05, 2006 15:35

Post by nedman47 »

i found a workaround for this issue

i added a 150 ms delay before turning off the cursor ...

Code: Select all

sleep 150
locate ,,0
a delay of 100 ms works sometimes but 150 works every time
Post Reply