Remove view doubt

copiloto

Member
Licensed User
Longtime User
Hi all,

I'm struggling myself about next code. My purpose is to create 100 labels and after, remove all them.
The first part is ok, but when I try to remove all of them, it seems like if they are removed in 2 steps: view1, view3, view5 ....

The code:

'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim canvas1 As Canvas
End Sub

Sub Activity_Create(FirstTime As Boolean)
activity.LoadLayout("mipanel.bal")
canvas1.Initialize(Activity)
For a=0 To 100
Dim v As Label
v.Initialize("Label")
activity.AddView(v,3,6,6,7)
v.Tag=a
Next

delete
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub delete
Dim counter As Int
counter=0
For a=0 To activity.NumberOfViews-1
Dim v As View
v=activity.GetView(a)
If v.Tag<>"" Then
v.RemoveView
Msgbox(v.Tag,"")
counter=counter+1
End If
Next
End Sub




Any ideas??

Thanks in advance!
 

copiloto

Member
Licensed User
Longtime User
Hi Merlot2309,

thanks for your answer,

really, "counter" doesn't affect. In fact, it can be deleted. The problem keep standing. I think it could be a little issue of b4a...

if you don't mind, could you try on your device this code?

Best regards!
 
Upvote 0

copiloto

Member
Licensed User
Longtime User
Thanks very much Agraham.

That worked!
Creating and removing views is giving me some headaches... Still have some problem obtaining viewer.tag in some situations. Will make the question in other thread, later.

Best regards.
 
Upvote 0
Top