S SternFaun Member Licensed User Feb 22, 2016 #1 Good evening together, I got the following problem: i create a ScrollView and add Checkboxes to it like this: Private Check as Checkbox Check.Initialize("Check") Activity.AddView(Check,10%x,10%y,25%x,15%y) Check.RemoveView Check.Tag = i 'i is an ongoing number with +1 for each view, starts at i=0 ScrollView1.Panel.AddView(Check,50%x,TOP-12dip,100%x,10%y) The problem is that I dont get the tag ("i") of my Checkbox by checking it in the app. I use this code: Sub Check_CheckedChange Check = Sender Msgbox(Check.tag, "Test") End Sub It always returns the last i (highest tag-number) which was added to the ScrollView.Panel. What can I do? I tried every thinkable variantions like: Msgbox(ScrollView1.Panel.GetView(Check.Tag).Tag,"Test") or others. The problem is that I dont get the Sender, but why. For Label-Views same seems to work. Thanks for your help!
Good evening together, I got the following problem: i create a ScrollView and add Checkboxes to it like this: Private Check as Checkbox Check.Initialize("Check") Activity.AddView(Check,10%x,10%y,25%x,15%y) Check.RemoveView Check.Tag = i 'i is an ongoing number with +1 for each view, starts at i=0 ScrollView1.Panel.AddView(Check,50%x,TOP-12dip,100%x,10%y) The problem is that I dont get the tag ("i") of my Checkbox by checking it in the app. I use this code: Sub Check_CheckedChange Check = Sender Msgbox(Check.tag, "Test") End Sub It always returns the last i (highest tag-number) which was added to the ScrollView.Panel. What can I do? I tried every thinkable variantions like: Msgbox(ScrollView1.Panel.GetView(Check.Tag).Tag,"Test") or others. The problem is that I dont get the Sender, but why. For Label-Views same seems to work. Thanks for your help!
stevel05 Expert Licensed User Longtime User Feb 22, 2016 #2 You need to initialize a new variable to assign Sender to: Code: Copy Dim NewCheck as Checkbox = Sender Msgbox(NewCheck.tag, "Test") Upvote 0
You need to initialize a new variable to assign Sender to: Code: Copy Dim NewCheck as Checkbox = Sender Msgbox(NewCheck.tag, "Test")
S SternFaun Member Licensed User Feb 22, 2016 #3 Problem solved: For each creation of a checkbox: Dim Check as Checkbox Check.Initialize("Check") Check.Tag = i 'i is an ongoing number with +1 for each view, starts at i=0 ScrollView1.Panel.AddView(Check,50%x,TOP-12dip,100%x,10%y) Upvote 0
Problem solved: For each creation of a checkbox: Dim Check as Checkbox Check.Initialize("Check") Check.Tag = i 'i is an ongoing number with +1 for each view, starts at i=0 ScrollView1.Panel.AddView(Check,50%x,TOP-12dip,100%x,10%y)
klaus Expert Licensed User Longtime User Feb 22, 2016 #4 I don't understand this code: Code: Copy Private Check As Checkbox Check.Initialize("Check") Activity.AddView(Check,10%x,10%y,25%x,15%y) Check.RemoveView Check.Tag = i 'i is an ongoing number with +1 for each view, starts at i=0 ScrollView1.Panel.AddView(Check,50%x,TOP-12dip,100%x,10%y) Why do you add the Checkboxes onto the Activity and remove them just after ? This code is enough: Code: Copy Private Check As Checkbox Check.Initialize("Check") Check.Tag = i 'i is an ongoing number with +1 for each view, starts at i=0 ScrollView1.Panel.AddView(Check,50%x,TOP-12dip,100%x,10%y) Upvote 0
I don't understand this code: Code: Copy Private Check As Checkbox Check.Initialize("Check") Activity.AddView(Check,10%x,10%y,25%x,15%y) Check.RemoveView Check.Tag = i 'i is an ongoing number with +1 for each view, starts at i=0 ScrollView1.Panel.AddView(Check,50%x,TOP-12dip,100%x,10%y) Why do you add the Checkboxes onto the Activity and remove them just after ? This code is enough: Code: Copy Private Check As Checkbox Check.Initialize("Check") Check.Tag = i 'i is an ongoing number with +1 for each view, starts at i=0 ScrollView1.Panel.AddView(Check,50%x,TOP-12dip,100%x,10%y)