The intersectionrectangle( function creates a rectangle by combining two rectangles. The new rectangle is the area where the two rectangles overlap (if any).
Parameters
This function has two parameters:
rectangle1 – is the first rectangle.
rectangle2 – is the second rectangle.
Description
The intersectionrectangle( function creates a rectangle by combining two rectangles. The new rectangle is the area where the two rectangles overlap (if any). If these two rectangles do not touch each other the function will return an empty rectangle (the same as rectangle(0,0,0,0) ). A rectangle is a raw binary data value (see Binary Data, Graphic Coordinates).
The illustration below shows how this function combines two rectangles, creating a third rectangle where the original two rectangles overlap:
The intersectionrectangle( function can be used to check if two rectangles overlap each other. The procedure below checks to see if the current window is on the main screen, or if it is on another screen.
if intersectionrectangle(
info("windowrectangle"),
info("screenrectangle")) = rectangle(0,0,0,0)
message "This window is completely off the main screen"
else
message "This window is partially on the main screen"
endif
See Also
adjustxy( -- adjusts the four corners of a rectangle. However, only corners
that are inside a boundary are adjusted. Corners outside the boundary are left alone.
bestfitrectangle -- fits a rectangle within a boundary rectangle, enlarging or reducing as necessary to produce the best fit without changing the proportions.
bestfitrectangle( -- fits a rectangle within a boundary rectangle, enlarging or reducing as necessary to produce the best fit without changing the proportions.
calcenclosingrectangle -- will calculate the rectangle surrounding all of the specified objects.
getbutton -- retrieves the coordinates of the last button that was pressed (in global screen co-ordinates).
getclick -- returns the location of the mouse in global coordinates (coordinates from the top left corner of the screen).
getinternalbutton -- retrieves the coordinates of the last button that was pressed (in form relative coordinates).
getlocalbutton -- retrieves the coordinates of the last button that was pressed (in window relative coordinates).
getlocalclick -- returns the location of the most recent mouse click in local coordinates (coordinates from the top left corner of the current form).
info("availablescreenrectangle") -- returns a rectangle defining the edges of the main screen, after deducting for the space of the menu bar and dock (if visible).
info("formxy") -- returns a point that indicates how much the current form is scrolled (if at all).
maprectangle( -- maps the position and size of a rectangle within a template rectangle into the same relative position and size within a goal rectangle.
Modifiable Object Properties -- describes the properties of graphic objects that can be modified by a program (dimensions, color, font, title, etc.).
moveobjects -- will move an object or group of objects up, down, left or right on the form.
nsrect( -- defines a rectangle using the same parameter order as the Cocoa NSMakeRect( function.
nsrectstr( -- converts a rectangle into text in the format x,y,width,height
pinrectangle( -- pins a rectangle within the bounds of a larger rectangle.
point( -- combines vertical and horizontal co-ordinates into a single binary value that describes the position of a point (see Graphic Coordinates).
pointstr( -- converts a point value into text in the format v,h (for example 34,56).
xytoxy( -- converts a point or rectangle from one co-ordinate system to another.
History
Version
Status
Notes
10.0
Updated
Unlike Panorama 6 and earlier, the parameters to this function are floating point values instead of integers (it will also accept integers). Also, the rectangle produced by this function is a 32 byte binary value, instead of an 8 byte text value.