When the user resizes a graphic window or a graphic view, the script of the resized object receives the following event.
resized the_object
the_object is a reference to the owner of the script, a graphic window or a graphic view.
Example
The example below, if installed in the script of a plot view, will adapt the frame of the graphic window to the window sizes, then draw a rectangle inside the frame each time the user resize the window.
on resized w
set frame of w to {0, 0, (get width of w) - 15, (get height of w) - 37}
BeginFigure(w)
SetPenGray(0)
SetPenWidth(2)
RectPath({10, 10, (get width of w) - 35, (get height of w) - 57})
DrawPath(2)
EndFigure()
draw w
end resized
Import script
To experiment with the script above, proceed as follows.
-
Run first the script below, which will create the plot.
set w to make new graphic window
-
Select Graphs ▸ Edit script then choose the window. This will open the graphic window's script.
-
Paste the script above, then save and close the script window with the File menu.
Now resize the window to call the script.
|