Been using Xojo since RealBasic 5.5 and I have been able to find solutions to my issues on the Forums or just hammering away at it until I fix them, but this one has me stumped.
I have one container control on a window, and I’m embedding two more container controls via code EmbedWithin, which works as expected pictured below.
I am referencing these two container controls in an Array Property:
PanelList(-1) As ContainerControl
What I want to do is check if the panel is already displayed and prevent the user from displaying it again, here is a simplified version of my code below.
Sub AddPanel(w As ContainerControl)
Dim panelTop As Integer
Dim panelHeight As Integer
Dim result As Integer = -1
Dim originalHeight As Integer = w.Height
result = PanelList.IndexOf(w)
if result > -1 then
return
end if
w.EmbedWithin(TimerWindow.AccessoryPanel, 0, panelTop, TimerWindow.AccessoryPanel.width, panelHeight)
w.LockRight = true
w.LockBottom = true
w.EraseBackground = false
PanelList.Append(w)
End Sub
But the result is always -1. That is, PanelList.IndexOf(w) always results -1. Yet in the debugger, the property “PanelList” is holding a reference to the two ContainerControls. Am I doing this right? This is based on the example I found in the Language Reference, only they are not using an array.
If I click the X to dismiss the “FTD” and “Notifications” ContainerControl, ContainerControl.close works, the control is removed and I remove the reference from my PanelList array.
I’m missing something here, but what? Sometimes I can’t see the forest through the trees.
By the way, this is an Autocross Timing and Scoring application that I have been working on for a long time!
I hope this makes sense, 'cause I’m stuck…
Thank you, Doug.