Some weeks ago I played around with a project to make a listbox of containers. I now want to add different containers to the listbox.
This is the code to add a container:
Public Sub AddItem(theContainer as ContainerControl)
theContainer.EmbedWithin(Self, 0, InsertOffset, Self.Width, theContainer.Height)
If theContainer IsA ItemContainerControl Then
Dim ICC As ItemContainerControl = ItemContainerControl(theContainer)
AddHandler ICC.RemoveMe, AddressOf ItemClickedRemove
End If
items.Append(theContainer)
theContainer.TabIndex = items.LastIndex
InsertOffset = InsertOffset + theContainer.Height
// resize container to fit new one
Self.Height = Max(Self.Height, InsertOffset)
End Sub
The reference to ItemContainerControl needs to be changed to an interface. I think that I need to use a delegate. But from examples and the docs I can’t work out what delegates are let alone use them.
Project:
ContainerControl List.xojo_xml_project.zip (8.6 KB)
10 posts - 4 participants