Group2D.RemoveAt

From Xojo Documentation

Method

Group2D.RemoveAt(Index as Integer)

New in 2019r2

Supported for all project types and targets.

Removes an object specified by its index.

Example

This example removes the first object, which is the image.

Var px As PixmapShape
Var t As TextShape
Var d As New Group2D
Var o As New Object2D

px = New PixmapShape(DSC_0343)
d.Add(px)

t = New TextShape
t.Y = 70
t.Value = "This is what I call a REAL car!"
t.FontName = "Helvetica"
t.IsBold = True
d.Add(t)

d.RemoveAt(0)
g.DrawObject(d, 100, 100)



Method

Group2D.Remove(Object as Object2D)

Supported for all project types and targets.

Removes an object specified by its reference.

Example

This example also removes the second item, which is the text.

Var px As PixmapShape
Var t As TextShape
Var d As New Group2D
Var o As New Object2D

px = New PixmapShape(DSC_0343)
d.Add(px)

t = New TextShape
t.Y = 70
t.Value = "This is what I call a REAL car!"
t.FontName = "Helvetica"
t.IsBold = True
d.Add(t)

d.Remove(d.Item(1))
g.DrawObject(d, 100, 100)