Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Last 2 parameters of Locate
#1
Question 
Are they (last 2 parameters in Locate) supposed to work in graphics screens ie not just screen 0?

This question came up at another forum and I couldn't find more explanation in Wiki. (Doesn't mean it's not there, just, I am terrible reader and could have missed it.)
b = b + ...
Reply
#2
(01-20-2024, 04:00 PM)bplus Wrote: Are they (last 2 parameters in Locate) supposed to work in graphics screens ie not just screen 0?

This question came up at another forum and I couldn't find more explanation in Wiki. (Doesn't mean it's not there, just, I am terrible reader and could have missed it.)
I've never really been able to get the last two parameters to do anything except in Screen 0 and then it only changes once.

Use this example I whipped up quick to see what I mean.

Code: (Select All)
DIM Cstart AS INTEGER
DIM Cstop AS INTEGER

' Press the ENTER key 31 times in each screen mode

SCREEN 0
Cstart = 0
Cstop = 31
DO
    CLS
    PRINT "SCREEN 0"
    PRINT "Cstart ="; Cstart
    PRINT "Cstop  ="; Cstop
    LOCATE 5, 5, 1, Cstart, Cstop
    INPUT t$
    Cstart = Cstart + 1
LOOP UNTIL Cstart = 31

SCREEN 2
Cstart = 0
DO
    CLS
    PRINT "SCREEN 2"
    PRINT "Cstart ="; Cstart
    PRINT "Cstop  ="; Cstop
    LOCATE 5, 5, 1, Cstart, Cstop
    INPUT t$
    Cstart = Cstart + 1
LOOP UNTIL Cstart = 31

SCREEN _NEWIMAGE(640, 480, 32)
Cstart = 0
DO
    CLS
    PRINT "SCREEN 640,480,32"
    PRINT "Cstart ="; Cstart
    PRINT "Cstop  ="; Cstop
    LOCATE 5, 5, 1, Cstart, Cstop
    INPUT t$
    Cstart = Cstart + 1
LOOP UNTIL Cstart = 31
There are two ways to write error-free programs; only the third one works.
QB64 Tutorial
Reply
#3
Thanks Terry, I did real quick experiment and came to same conclusion.

Steve was over seeing us there but someone changed the abilty for guests to post (not me, though I advised it with all the damn spammers we were getting before I found a way to play a trick on them ; - ) ) .)
b = b + ...
Reply
#4
(01-20-2024, 04:38 PM)bplus Wrote: Thanks Terry, I did real quick experiment and came to same conclusion.

Steve was over seeing us there but someone changed the abilty for guests to post (not me, though I advised it with all the damn spammers we were getting before I found a way to play a trick on them ; -  ) ) .)
I just ran the code in QuickBasic 4.5 and it acts differently.

Screen 0: When Cstart = 1 and 2 there is a slight difference in the size of the cursor at the top. When Cstart hits 3 the cursor jumps to half size just like in QB64. When Cstart hits 29 and 30 the cursor gets very small and then to a single scan line.

Screen 1 and 2: The cursor is replaced with random ASCII characters.

Screens 9 through 13: When Cstart =4 the cursor jumps to quarter size and then back to full size when 5 is reached.

I tested this out in QB4.5 because I was sure years ago I was able to have more control over the cursor size than what QB64 allows. It's still odd behavior in QB4.5 with slightly more control though.
There are two ways to write error-free programs; only the third one works.
QB64 Tutorial
Reply
#5
Honestly, most flexible is just use LOCATE to make an invisible cursor and then draw your own.  Wink
Reply
#6
(01-20-2024, 06:22 PM)SMcNeill Wrote: Honestly, most flexible is just use LOCATE to make an invisible cursor and then draw your own.  Wink

Yeah, that's what I did in my graphics line input library.
There are two ways to write error-free programs; only the third one works.
QB64 Tutorial
Reply




Users browsing this thread: 1 Guest(s)