Author Topic: LOCATE FUNCTION  (Read 3727 times)

0 Members and 1 Guest are viewing this topic.

Offline Rich

  • Newbie
  • Posts: 8
    • View Profile
LOCATE FUNCTION
« 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

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: LOCATE FUNCTION
« Reply #1 on: January 30, 2020, 07:11:05 pm »
FOR I = 1 TO 10
    LOCATE 10, I
    PRINT CHR$(177)
NEXT
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: LOCATE FUNCTION
« Reply #2 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
« Last Edit: January 30, 2020, 10:21:11 pm by bplus »

Offline Rich

  • Newbie
  • Posts: 8
    • View Profile
Re: LOCATE FUNCTION
« Reply #3 on: January 31, 2020, 09:12:51 am »
Thank you for the examples and quick response.

Offline Rich

  • Newbie
  • Posts: 8
    • View Profile
Re: LOCATE FUNCTION
« Reply #4 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

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: LOCATE FUNCTION
« Reply #5 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!
« Last Edit: January 31, 2020, 01:19:59 pm by bplus »