HOME: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "Building Blocks Categories" to "Building Blocks") |
m (1 revision imported) |
Latest revision as of 03:04, 11 October 2023
Description
- This command places the drawing pen to the center of a graphics window or graphics box.
Syntax
Graphics Window
- print #WindowHandle, "home"
- #WindowHandle "home"
Graphics Box
- print #WindowHandle.ControlExtension, "home"
- #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