Hello,
I use httpjobs to retrieve a int (toplammarketing) value from my server . Later i use for example at jobdone i use to set the checkbox checked values accoridng to total marketing cost: ( switchmarketing is check box -poritng from b4i)
Also i need to use below code to let my user change marketing options :
my problem is : lets say i retrieve 7500000 from httpjobs for total marketing , It makes according to first code switchmartketing 0 and 1 false and switchmarketing 2 true.
but when switchmarketing 2 is checked to true automaticly, it adds another 7500000 to total cost and it makes the lblmarketing(3).text = 15000000 instead of 7500000. in ios if user is not changing the value by hand ( which is the case now , it does not add it but here when according to first code i get the value of 7500000 i need to make switchmarketing(2).checked=true and when it is done the code goes to valuechanged sub and adds 7500000 more. How can i fix ths ?
TY
I use httpjobs to retrieve a int (toplammarketing) value from my server . Later i use for example at jobdone i use to set the checkbox checked values accoridng to total marketing cost: ( switchmarketing is check box -poritng from b4i)
B4X:
If toplammarketing=1500000 Then
switchmarketing(0).checked=True
switchmarketing(1).checked=False
switchmarketing(2).checked=False
else If toplammarketing=3000000 Then
switchmarketing(1).checked=True
switchmarketing(0).checked=False
switchmarketing(2).checked=False
else if toplammarketing=7500000 Then
switchmarketing(2).checked=True
switchmarketing(0).checked=False
switchmarketing(1).checked=False
else if toplammarketing=4500000 Then
switchmarketing(0).checked=True
switchmarketing(1).checked=True
switchmarketing(2).checked=False
else if toplammarketing=9000000 Then
switchmarketing(0).checked=True
switchmarketing(1).checked=False
switchmarketing(2).checked=True
else if toplammarketing=10500000 Then
switchmarketing(0).checked=False
switchmarketing(1).checked=True
switchmarketing(2).checked=True
else if toplammarketing=12000000 Then
switchmarketing(0).checked=True
switchmarketing(1).checked=True
switchmarketing(2).checked=True
else if toplammarketing=0 Then
switchmarketing(0).checked=False
switchmarketing(1).checked=False
switchmarketing(2).checked=False
End If
Also i need to use below code to let my user change marketing options :
B4X:
Sub switchmarketing_CheckedChange(Checked As Boolean)
Dim sw As CheckBox=Sender
Select Case sw.Tag
Case "internet"
If Checked=True Then
toplammarketing=toplammarketing+1500000
Else
toplammarketing=toplammarketing-1500000
End If
Case "radio"
If Checked=True Then
toplammarketing=toplammarketing+3000000
Else
toplammarketing=toplammarketing-3000000
End If
Case "tv"
If Checked=True Then
toplammarketing=toplammarketing+7500000
Else
toplammarketing=toplammarketing-7500000
End If
End Select
'labelmarketing(3).Text="Total Cost: $" & NumberFormat2(toplammarketing,0,0,0,True)
End Sub
my problem is : lets say i retrieve 7500000 from httpjobs for total marketing , It makes according to first code switchmartketing 0 and 1 false and switchmarketing 2 true.
but when switchmarketing 2 is checked to true automaticly, it adds another 7500000 to total cost and it makes the lblmarketing(3).text = 15000000 instead of 7500000. in ios if user is not changing the value by hand ( which is the case now , it does not add it but here when according to first code i get the value of 7500000 i need to make switchmarketing(2).checked=true and when it is done the code goes to valuechanged sub and adds 7500000 more. How can i fix ths ?
TY