![]() |
Forum Index : Microcontroller and PC projects : Positioning and locating cursor
Author | Message | ||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
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: AustraliaPosts: 261 |
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: AustraliaPosts: 6283 |
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 KingdomPosts: 2170 |
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: AustraliaPosts: 261 |
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: AustraliaPosts: 1097 |
@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: AustraliaPosts: 261 |
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: AustraliaPosts: 341 |
I wrote a locate function for backwards compatibility with older basic listed here. 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: AustraliaPosts: 261 |
Yes, working on that Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
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: AustraliaPosts: 1882 |
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: AustraliaPosts: 341 |
That gives me an idea. 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: AustraliaPosts: 7 |
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. ![]() |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |