"Locate" wrong position

New to FreeBASIC? Post your questions here.
Bad_Idea
Posts: 4
Joined: Sep 11, 2017 3:46

"Locate" wrong position

Postby Bad_Idea » Sep 11, 2017 3:50

Hello :)
I have a weird issue with "Locate". It works fine in a console-window with 80x24, but when it's bigger than 24 rows, the locating doesn't work anymore.
This code works fine with 80x24, but it doesn't with everything above:

Code: Select all

ymax=HiWord(Width)
For i As Integer=1 To ymax
   Locate i,20
   Print "H"
Next

It should print a "H" from top to bottom in column 20. But when i>24, it prints them at column 1 instead.
fxm
Posts: 7151
Joined: Apr 22, 2009 12:46
Location: Paris suburb, FRANCE

Re: "Locate" wrong position

Postby fxm » Sep 11, 2017 11:58

Welcome to the forum!

Yes, auto-scrolling disrupts the behavior of the full LOCATE statement.
Workaround: execute the positioning in 2 successive steps:

Code: Select all

For i As Integer=1 To ymax
   Locate i
   Locate ,20
   Print "H"
Next
Bad_Idea
Posts: 4
Joined: Sep 11, 2017 3:46

Re: "Locate" wrong position

Postby Bad_Idea » Sep 12, 2017 4:31

Hm, weird. But it is working now thanks. :)
I guess I should take a look at ncurses instead.
counting_pine
Site Admin
Posts: 5777
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: "Locate" wrong position

Postby counting_pine » Sep 12, 2017 11:56

Could someone post a bug report?
Is this in Linux or Windows/elsewhere? (I'm guessing the former.)
(Are you any relation to badidea, by any chance?)
Bad_Idea
Posts: 4
Joined: Sep 11, 2017 3:46

Re: "Locate" wrong position

Postby Bad_Idea » Sep 12, 2017 12:08

I am on Linux.
And no, i am not the other guy. I am the worse idea.
fxm
Posts: 7151
Joined: Apr 22, 2009 12:46
Location: Paris suburb, FRANCE

Re: "Locate" wrong position

Postby fxm » Sep 12, 2017 12:55

badidea
Posts: 542
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: "Locate" wrong position

Postby badidea » Sep 13, 2017 21:31

Are you any relation to badidea, by any chance?

Not that i know :-) Also on linux BTW

Add ";' to omit the line break:

Code: Select all

dim as integer ymax=HiWord(Width)
For i As Integer=1 To ymax
   Locate i,20
   Print "H";
Next
sleep

Return to “Beginners”

Who is online

Users browsing this forum: fxm and 2 guests