QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Rich on January 30, 2020, 06:57:09 pm

Title: LOCATE FUNCTION
Post by: Rich on January 30, 2020, 06:57:09 pm
Hi,

I am a newbie, so please excuse the question. I would like to know if it is possible to use For/Next to increment the cursor location and print ASC character 177? Can you provide a simple example?

Thanks,

Rich
Title: Re: LOCATE FUNCTION
Post by: SMcNeill on January 30, 2020, 07:11:05 pm
FOR I = 1 TO 10
    LOCATE 10, I
    PRINT CHR$(177)
NEXT
Title: Re: LOCATE FUNCTION
Post by: bplus on January 30, 2020, 07:16:53 pm
Code: QB64: [Select]
  1. FOR a = 1 TO 255
  2.     LOCATE a MOD 25 + 1, INT(a / 25) * 7 + 1: PRINT _TRIM$(STR$(a)); ", "; CHR$(a);
  3.  

update: whole chart
Title: Re: LOCATE FUNCTION
Post by: Rich on January 31, 2020, 09:12:51 am
Thank you for the examples and quick response.
Title: Re: LOCATE FUNCTION
Post by: Rich on January 31, 2020, 01:13:11 pm
S McNeill,

It looks as though your code writes over the top of chr$(177) and never advances across the screen. Am I seeing this correctly?

Rich
Title: Re: LOCATE FUNCTION
Post by: bplus on January 31, 2020, 01:17:20 pm
S McNeill,

It looks as though your code writes over the top of chr$(177) and never advances across the screen. Am I seeing this correctly?

Rich

He is printing across the screen, columns 1 to 10

Here is vertical printing by reversing Rows with Columns
Code: QB64: [Select]
  1. FOR I = 1 TO 10
  2.     LOCATE I, 10    'LOCATE row (vertical) , column (across or horizontal)
  3.     PRINT CHR$(177)
  4.  

BTW that's an I (capital i) not a 1 (one) they look allot alike!