BBC BASIC for Windows
« Graphics Cursor Position »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:10pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Graphics Cursor Position  (Read 524 times)
JB91
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 47
xx Graphics Cursor Position
« Thread started on: Nov 19th, 2011, 12:17pm »

How do you detect what character there is in a certain position, but the text is written at the graphics cursor position, not the text cursor position?
GET doesn't work... sad
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Graphics Cursor Position
« Reply #1 on: Nov 19th, 2011, 4:40pm »

on Nov 19th, 2011, 12:17pm, JB91 wrote:
How do you detect what character there is in a certain position, but the text is written at the graphics cursor position, not the text cursor position?
GET doesn't work... sad

Simple answer - you can't!

More complicated answer - sometimes you can, but not always! If you know the coordinates at which a character was plotted you can convert them to a text row and column (you need to take into account the current ORIGIN, the height of the graphics viewport, the average width and height of the currently selected font etc.). Having got a corresponding row and column you can use GET(x,y) which may return the character.

However it's not reliable, because (with a proportional-spaced font) at least two narrow characters (e.g. a lowercase ij) will fit in the width of a single text 'column'. So GET(x,y) can only return a single character, not both of them.

If you happen to be plotting a monospaced font in VDU 5 mode (which is not particularly common) then you should in principle be able to read the text back reliably using GET so long as you can calculate the corresponding row and column accurately (this assumes that the text viewport and the graphics viewport are overlapping).

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls