POSXY

From Liberty BASIC Family
Jump to navigation Jump to search
Supported in Just BASIC Supported in Liberty BASIC Not supported in Liberty BASIC 5 Not supported in Run BASIC

Description

In a graphics window or graphic-box, POSXY places the current x,y coordinates of the pen in the specified variables.

Syntax

This command is NOT case sensitive.

  1. #handle "posxy xVar yVar" - in graphics window
  2. #handle.ext "posxy xVar yVar" - in graphicbox

Hints

Here is a list of commands that affect the pen position or status:

Example

An example of the command in a graphics window.

nomainwin
    WindowWidth=400
    WindowHeight=300

    open "Command Demo" for graphics_nsb_nf as #g
    #g "trapclose [quit]"

    'put pen down
    #g "down; home"
    'get pen position
    #g "posxy x y"
    'set pen size
    #g "size 3"
    'print the coordinates of home position
    #g "color blue"
    #g "\\"; x; " "; y
    'place dot at center of circle and draw circle
    #g "set "; x; " "; y
    #g "color red; circle 50"
    'draw a radial dimension line
    #g "home; color black; size 1; north"
    #g "turn 45; go 50"
    'get current pen position
    #g "posxy cx cy"
    'place pen in position for text and print radius
    #g "up; goto "; cx+10; " ";cy-10
    #g "color blue;\r=50"
    wait

[quit]
    close #g
    end

An example of the command in a graphicbox.

nomainwin
    WindowWidth=400
    WindowHeight=300

    graphicbox #g.gb 2, 2, 390, 270
    open "Command Demo" for window_nf as #g
    #g "trapclose [quit]"

    'put pen down
    #g.gb "down; home"
    'get pen position
    #g.gb "posxy x y"
    'print crosshairs
    #g.gb "line ";x-10;" ";y;" ";x+10;" ";y
    #g.gb "line ";x;" ";y-10;" ";x;" ";y+10
    'print the coordinates of home position
    #g.gb "color blue"
    #g.gb "\\"; x; " "; y
    wait

[quit]
    close #g
    end

Useful Procedures

' Place a useful function or sub using this keyword here