HOME

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

This command places the drawing pen to the center of a graphics window or graphics box.

Syntax

Graphics Window

  1. print #WindowHandle, "home"
  2. #WindowHandle "home"

Graphics Box

  1. print #WindowHandle.ControlExtension, "home"
  2. #WindowHandle.ControlExtension "home"

Hints

Place useful hints about this keyword here

Example

    nomainwin
    open "A Blue Circle at the Center" for graphics_nsb as #main
    print #main, "trapclose [quit]"
    print #main, "down"
    print #main, "backcolor blue"

    'center the drawing pen
    print #main, "home"

    '...and draw the circle
    print #main, "circlefilled 10"
    print #main, "flush"
    wait

[quit]
    close #main
    end

Useful Procedures

Getting the Size of the Graphics Area

sub GraphicsArea handle$, byref width, byref height
    'Determines the width and height of a graphics window (excluding borders) / graphicbox
    'handle$ - handle of a graphics window or a graphicbox
    'width - receives the width
    'height - receives the height

    print #handle$, "home; posxy w h"
    width = w * 2
    height = h * 2
end sub

Getting the Center of the Graphics Area

sub GetGraphicsCenter Handle$, byref CenterX, byref CenterY
    'Determines the center of a graphics area
    'Handle$ - handle of a graphics window or box
    'CenterX - receives the position of the center along the X axis
    'CenterY - receives the position of the center along the Y axis

    #Handle$ "home"
    #Handle$ "posxy CenterX CenterY"
end sub