Hi there..
I am using multiple CLV to load the same layout, 5 of them. The layout used has a rangeslider and there could be 5,10,20 items in the different CLVs.
Each and everytime the value of the rangeslider changes I want to update some values in a label. This works perfectly. The problem is that when loading each of the CLV items, the rangeslider_valuechange event is being fired, I guess due to the loadlayout method.
How do I NOT fire this event on creation of the CLV items and only fire it when a user actually changes the rangeslider value?
Thanks..
This code works well for doing the updates but fires everytime the CLV item is added with the range slider...
I have tried to set a boolean value to true on load and then false after the load, does nothing..
This is the code to load each CLV item...
I am using multiple CLV to load the same layout, 5 of them. The layout used has a rangeslider and there could be 5,10,20 items in the different CLVs.
Each and everytime the value of the rangeslider changes I want to update some values in a label. This works perfectly. The problem is that when loading each of the CLV items, the rangeslider_valuechange event is being fired, I guess due to the loadlayout method.
How do I NOT fire this event on creation of the CLV items and only fire it when a user actually changes the rangeslider value?
Thanks..
This code works well for doing the updates but fires everytime the CLV item is added with the range slider...
B4X:
Sub aSlider_ValueChange (LowValue As Double, HighValue As Double)
If bLoading = True Then Return
Dim slider As RangeSlider = Sender
Dim q As Map = slider.Tag
Dim key As String = q.getdefault("key","")
Dim prefix As String = jMash.MvField(key,1,".")
Dim learner As String = q.GetDefault("learner","")
Select Case prefix
Case "1"
SeLabel(lstActivity1,learner,key,Round2(HighValue,0))
Case "2"
SeLabel(lstActivity2,learner,key,Round2(HighValue,0))
Case "3"
SeLabel(lstActivity3,learner,key,Round2(HighValue,0))
Case "4"
SeLabel(lstActivity4,learner,key,Round2(HighValue,0))
Case "5"
SeLabel(lstActivity5,learner,key,Round2(HighValue,0))
Case "c"
SeLabel(lstCumulative,learner,key,Round2(HighValue,0))
End Select
End Sub
I have tried to set a boolean value to true on load and then false after the load, does nothing..
This is the code to load each CLV item...
B4X:
Sub CreateQuestion(q As Map) As B4XView
'get marks for learner
Dim learnerm As String = q.GetDefault("learner","")
Dim key As String = q.GetDefault("key","")
key = learnerm & key
Dim marks As String = kvs.GetSimple(key)
If marks = "" Then marks = "0"
q.Put("achieved", marks)
Dim p As Pane
p.Initialize("")
p.LoadLayout("vQuestion")
lblQuestion.Text = " " & q.GetDefault("q","")
aSlider.MaxValue = q.GetDefault("max",5)
aSlider.MinValue = q.GetDefault("min",0)
aSlider.HighValue = q.GetDefault("achieved",0)
aSlider.LowValue = q.GetDefault("achieved",0)
aSlider.MajorTickUnit = q.GetDefault("tick",1)
lblAchieved.Text = q.GetDefault("achieved",0)
lblAchieved.Tag = q.GetDefault("key","")
lblMark.Text = q.GetDefault("max",5)
chkNone.Checked = q.GetDefault("none",False)
If lblQuestion.text = " Totals" Or lblQuestion.Text.StartsWith(" Activity") Then
p.Enabled = False
aSlider.Visible = False
Else
p.Enabled = True
aSlider.Visible = True
End If
p.Tag = q
aSlider.Tag = q
Return p
End Sub