I am writing a program that consists of panels 5 across and 5 down with a label in each panel to give the effect of a border. Connecting each panel is a link consisting of a small panel within a panel, again to represent a border on the link. Each square is initially filled with a letter of the alphabet which is then randomly swapped from one square to another. The problem occurs when the letters are swapped with the effect that the links are somehow either moved, slightly covered up or in some way corrupted. All the panels and links are created within the program. I am at a loss as to where/what the problem may be.
Code to create squares:
' Column 1 Squares
For x = 0 To 4
Dim p As Panel
' Add panel
p.Initialize("pnlSquare")
p.Background = cdPanel
p.Tag = intSquareNo
Activity.AddView(p, 263, 6 + (x * 100), 90dip, 90dip)
' Add letter label as view=0
lblLetter.Initialize("lblLetter")
lblLetter.Background = cdLetter
lblLetter.TextColor = Colors.Black
lblLetter.Text = strLetters.CharAt(intSquareNo)
lblLetter.TextSize = 60
lblLetter.Typeface = Main.ErasBoldFont
lblLetter.Gravity = Gravity.CENTER
p.AddView(lblLetter, 4, 4, 82, 82)
pnlSquare(intSquareNo) = p
intSquareNo = intSquareNo + 1
Next
Code to create links between column 1 and column 2
' Column 1-2 Links
For x = 0 To 8
Dim p As Panel
' Add panel
p.Initialize("pnlLink")
p.Background = cdLink
p.Tag = intLinkNo
Activity.AddView(p, 349, 68 + (x * 50), 24dip, 16dip)
' Add Colour Panel As View 0
pnlColour.Initialize("pnlColour")
pnlColour.Background = cdLinkGold
pnlColour.Tag = intLinkNo
p.AddView(pnlColour, 4, 4, 20, 8)
pnlLink(intLinkNo) = p
intLinkNo = intLinkNo + 1
Next
Code in timer to randomise letters:
Sub Timer1_Tick
intRndNo1 = 0
intRndNo2 = 0
DoWhileintRndNo1 = intRndNo2
intRndNo1 = Rnd(0,25)
intRndNo2 = Rnd(0,25)
Loop
lblLetter = pnlSquare(intRndNo1).GetView(0)
strLetter1= lblLetter.Text
Log (strLetter1)
lblLetter = pnlSquare(intRndNo2).GetView(0)
strLetter2 = lblLetter.Text
Log (strLetter2)
Log ("===")
lblLetter.Text = strLetter1
lblLetter = pnlSquare(intRndNo1).GetView(0)
lblLetter.Text = strLetter2
End Sub
Code to create squares:
' Column 1 Squares
For x = 0 To 4
Dim p As Panel
' Add panel
p.Initialize("pnlSquare")
p.Background = cdPanel
p.Tag = intSquareNo
Activity.AddView(p, 263, 6 + (x * 100), 90dip, 90dip)
' Add letter label as view=0
lblLetter.Initialize("lblLetter")
lblLetter.Background = cdLetter
lblLetter.TextColor = Colors.Black
lblLetter.Text = strLetters.CharAt(intSquareNo)
lblLetter.TextSize = 60
lblLetter.Typeface = Main.ErasBoldFont
lblLetter.Gravity = Gravity.CENTER
p.AddView(lblLetter, 4, 4, 82, 82)
pnlSquare(intSquareNo) = p
intSquareNo = intSquareNo + 1
Next
Code to create links between column 1 and column 2
' Column 1-2 Links
For x = 0 To 8
Dim p As Panel
' Add panel
p.Initialize("pnlLink")
p.Background = cdLink
p.Tag = intLinkNo
Activity.AddView(p, 349, 68 + (x * 50), 24dip, 16dip)
' Add Colour Panel As View 0
pnlColour.Initialize("pnlColour")
pnlColour.Background = cdLinkGold
pnlColour.Tag = intLinkNo
p.AddView(pnlColour, 4, 4, 20, 8)
pnlLink(intLinkNo) = p
intLinkNo = intLinkNo + 1
Next
Code in timer to randomise letters:
Sub Timer1_Tick
intRndNo1 = 0
intRndNo2 = 0
DoWhileintRndNo1 = intRndNo2
intRndNo1 = Rnd(0,25)
intRndNo2 = Rnd(0,25)
Loop
lblLetter = pnlSquare(intRndNo1).GetView(0)
strLetter1= lblLetter.Text
Log (strLetter1)
lblLetter = pnlSquare(intRndNo2).GetView(0)
strLetter2 = lblLetter.Text
Log (strLetter2)
Log ("===")
lblLetter.Text = strLetter1
lblLetter = pnlSquare(intRndNo1).GetView(0)
lblLetter.Text = strLetter2
End Sub