Name
Undo -- undo a graphics operation
Synopsis
Undo(type[, id, level, quiet])
Function
This function undoes the graphics operation specified by type and optionally id. You need to enable layers in order to use this function. Hollywood keeps an internal buffer of all graphics operations it performs, e.g. displaying brush 2. If you want to remove brush 2 now from the display, just call Undo(#BRUSH,2). The following types are possible:

#ANIM
Remove anim specified by id from the display

#ARC
Remove arc drawn with Arc()

#BGPICPART
Remove graphics displayed with DisplayBGPicPart()

#BOX
Remove rectangle drawn with Box()

#BRUSH
Remove brush specified by id from the display

#BRUSHPART
Remove graphics displayed with DisplayBrushPart()

#CIRCLE
Remove circle drawn with Circle()

#ELLIPSE
Remove ellipse drawn with Ellipse()

#LINE
Remove line drawn with Line()

#MERGED:
Remove merged layer created by MergeLayers().

#PLOT
Remove a pixel displayed with Plot()

#POLYGON
Remove polygon drawn with Polygon()

#PRINT
Remove text printed with Print() or NPrint()

#TEXTOBJECT
Remove text object specified by id from the display

#TEXTOUT
Undo the last TextOut() command; id is not required

#VECTORPATH
Undo the last DrawPath() command; id is not required

#VIDEO
Remove video specified by id from the display

The optional argument id is only required for types which use an identifier (#ANIM, #BGPICPART, #BRUSH, #BRUSHPART, #TEXTOBJECT, #VIDEO). The other types do not require the id argument. Please set id to 0 for the commands.

The level argument specifies the undo level to use. The argument is optional and defaults to 1. Undo level defines on which level the object to undo is. For example, if you display brush 3 four times on the display and now you want to remove the first one of all brushes 3, you will have to specify a level of 4. To remove the last one you have to set undo level to 1, which is also the default. Therefore if level is not explicitly specified or set to 1, Hollywood will undo the object last displayed of the specified type.

The quiet argument is also optional. If you set it to True, Hollywood will only remove the specified object from it is internal object lists but will leave it on the display. If set to False, Hollywood will also remove it from the screen.

Inputs
type
one of the type constants (see list above)
id
optional: only required for types which require an associated id (defaults to 0)
level
optional: undo level (defaults to 1)
quiet
optional: True if object shall only be removed internally but not from the display (defaults to False)
Example
EnableLayers()
DisplayBrush(1, #CENTER, #CENTER)
WaitLeftMouse
Undo(#BRUSH, 1)
The above code displays brush 1 in the center of the display, waits for a mouse click and then removes it.


EnableLayers()
Print("Hello ")
Print("This ")
Print("Is ")
Print("An ")
Print("Undo ")
Print("Test!")
WaitLeftMouse
Undo(#PRINT, 0, 6)
Undo(#PRINT, 0, 5)
Undo(#PRINT, 0, 4)
The above code prints "Hello This Is An Undo Test!" on the display, waits for a mouse click and then removes the texts "Hello", "This" and "Is" by using the optional level argument of the Undo() command.

Show TOC