Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:46 03 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Positioning and locating cursor

Author Message
Herry

Senior Member

Joined: 31/05/2014
Location: Australia
Posts: 261
Posted: 09:22pm 20 Aug 2020
Copy link to clipboard 
Print this post

In the old Microsoft QBASIC there were commands that allowed the cursor to be programmably be positioned anywhere on the screen or its position (as influenced by up and down arrows) to be reported back to the program, using LOCATE and POS, neither of which seem to be in Maximite Basic. Any suggestions?
Senior?!  Whatever it says, I'm a complete and utter beginner...
 
Herry

Senior Member

Joined: 31/05/2014
Location: Australia
Posts: 261
Posted: 09:40pm 20 Aug 2020
Copy link to clipboard 
Print this post

Now found POS in obsolete list but it is apparently for horizontal cursor position on a line. I want to be able to locate the vertical position on the screen...
Senior?!  Whatever it says, I'm a complete and utter beginner...
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 09:40pm 20 Aug 2020
Copy link to clipboard 
Print this post

The cursor will be positioned immediately after and text that you show with PRINT.
IT will only show if the system is waiting for input.
To print text at a predetermined location you can use PRINT @(x,y)
If you follow the text to print with a semi-colon, the cursor will not move to a new line.
You can also use the TEXT command.

To monitor the arrow keys, use either INKEY$ or KEYDOWN, depending on your needs (or preference).

Jim
VK7JH
MMedit
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 09:45pm 20 Aug 2020
Copy link to clipboard 
Print this post

if it's on the serial console using a VT terminal emulator (I use PuTTY)

then this will help a lot

http://www.fruitoftheshed.com/MMBasic.Simple-screen-Control-for-ANSI-based-Consoles-VT100-etc.ashx  also links (at the bottom) to a nice on-screen string editor; pass a string in , maximum length, and get it back. Non-blocking, and won't muck up your nice terminal screens like Input
 
Herry

Senior Member

Joined: 31/05/2014
Location: Australia
Posts: 261
Posted: 09:50pm 20 Aug 2020
Copy link to clipboard 
Print this post

  TassyJim said  The cursor will be positioned immediately after and text that you show with PRINT.
IT will only show if the system is waiting for input.
To print text at a predetermined location you can use PRINT @(x,y)
If you follow the text to print with a semi-colon, the cursor will not move to a new line.
You can also use the TEXT command.

To monitor the arrow keys, use either INKEY$ or KEYDOWN, depending on your needs (or preference).

Jim


Thanks. Found PRINT@, now to look into INKEYS and KEYDOWN

UPDATE*** Cannot see how I can report the x or Y position of the cursor using either INKEY$ or KEYDOWN. BTW the old BASIC used CSRLIN
Edited 2020-08-21 07:58 by Herry
Senior?!  Whatever it says, I'm a complete and utter beginner...
 
Chopperp

Guru

Joined: 03/01/2018
Location: Australia
Posts: 1097
Posted: 11:00pm 20 Aug 2020
Copy link to clipboard 
Print this post

@Herry

>Senior?! Whatever it says, I'm a complete and utter beginner...

Don't worry about it. A few more posts & you will become a GURU!!!

Brian
ChopperP
 
Herry

Senior Member

Joined: 31/05/2014
Location: Australia
Posts: 261
Posted: 11:41pm 20 Aug 2020
Copy link to clipboard 
Print this post

I think I've got it. I'll establish a datum by printing @(x,y). Then I'll keep track of cursor movements up or down (in a variable),  and that way I've got the cursor posn.
Senior?!  Whatever it says, I'm a complete and utter beginner...
 
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 01:03am 21 Aug 2020
Copy link to clipboard 
Print this post

I wrote a locate function for backwards compatibility with older basic listed here.

  Herry said  I think I've got it. I'll establish a datum by printing @(x,y). Then I'll keep track of cursor movements up or down (in a variable),  and that way I've got the cursor posn.


And I think you'd need to update the cursor position with print @(x,y); when it moves, I don't think the keypresses will move it themselves.
 
Herry

Senior Member

Joined: 31/05/2014
Location: Australia
Posts: 261
Posted: 01:12am 21 Aug 2020
Copy link to clipboard 
Print this post

  capsikin said  I wrote a locate function for backwards compatibility with older basic listed here.

  Herry said  I think I've got it. I'll establish a datum by printing @(x,y). Then I'll keep track of cursor movements up or down (in a variable),  and that way I've got the cursor posn.


And I think you'd need to update the cursor position with print @(x,y); when it moves, I don't think the keypresses will move it themselves.


Yes, working on that
Senior?!  Whatever it says, I'm a complete and utter beginner...
 
Herry

Senior Member

Joined: 31/05/2014
Location: Australia
Posts: 261
Posted: 02:20am 21 Aug 2020
Copy link to clipboard 
Print this post

Making good progress, but it would be good if there could be an x,y option in text lines and characters...
Senior?!  Whatever it says, I'm a complete and utter beginner...
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 04:39am 21 Aug 2020
Copy link to clipboard 
Print this post


MM. HRES
Returns the width of the display (the X axis) in pixels.

MM. VRES
Returns the height of the display (the Y axis) in pixels.

MM.INFO(FONTHEIGHT)
Returns the height of the current font (in pixels).  All characters in a font have the same height.

MM.INFO(FONTWIDTH)
Returns the width of a character in the current font (in pixels).  All characters in a font have the same
width.

MM.INFO(HPOS)
Returns the X coordinate of the text cursor (ie, the horizontal location (in pixels) of where the next
character will be printed on the VGA monitor)

MM.INFO(VPOS)
Returns the Y coordinate of the text cursor (ie, the vertical location (in pixels) of where the next
character will be printed on the VGA monitor)


I use these to calculate and return the cursor position in a small edit window function.
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 341
Posted: 12:44am 29 Aug 2020
Copy link to clipboard 
Print this post

  Herry said  Making good progress, but it would be good if there could be an x,y option in text lines and characters...


That gives me an idea.

  KeepIS said  
MM.INFO(FONTHEIGHT)
Returns the height of the current font (in pixels).  All characters in a font have the same height.

MM.INFO(FONTWIDTH)
Returns the width of a character in the current font (in pixels).  All characters in a font have the same
width.


I'm going to try something like this next time I need it:

Sub LOCATECELL x,y
 Print @(x*MM.INFO(FONTWIDTH),y*MM.INFO(FONTHEIGHT));
End Sub
 
xmarkf

Newbie

Joined: 16/08/2020
Location: Australia
Posts: 7
Posted: 11:01am 27 Sep 2020
Copy link to clipboard 
Print this post

This is probably worth a new discussion but on the topic of VTs /consoles.
I am wanting to use the CMM2 as a terminal. I noticed when you have serial terminal connected it does the VT100/52 thing. Can this be forced on when a program is active to become a VT100?
I would love to use it as what I call a K.A.T. Kick Ass Terminal. With graphics etc. for my Zeta2 I so want a 3D rotating Enterprise on the opening screen of super star trek.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025