Android Question accessing xGauges in CustomListView?

zak

Member
Licensed User
Longtime User
Hello. I created a layout in the designer with a xGauges Class from (https://www.b4x.com/android/forum/threads/b4x-xui-xgauges-class.98932/#content), and tried to insert the layout into a CustomListView, but was unable to individually access each xGauge. For example the below code:

B4X:
    Sub CheckBox1_CheckedChange(Checked As Boolean)
    Dim index As Int = CLV1.GetItemFromView(Sender)
    Dim pnl As B4XView = CLV1.GetPanel(index)
    Dim xgau As xGauges = pnl.GetView(index)
    xgau.Value= 50

would give a 'Types do not match warning' and a 'java.lang.RuntimeException: Field: ba not found in: android.widget.CheckBox' error

any idea on how to do it?
 

zak

Member
Licensed User
Longtime User
Tx. The needle is now rotating to the new value. However properties like GaugeTitle or GaugeUnit are not dynamically taking on new values:

B4X:
Sub CheckBox1_CheckedChange(Checked As Boolean)
    Dim index As Int = CLV1.GetItemFromView(Sender)
    Dim pnl As B4XView = CLV1.GetPanel(index)
    Dim xgau As xGauges = pnl.GetView(index)
    xgau.Value= 50  'working
    xgau.GaugeTitle="Consumption"   'not working
    xgau.GaugeUnit= "Kwh"     'not working
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You should start a new thread for any new question/issue.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I see it too.
Can you please test the attached class file.
I will update the Class thread tomorrow.

EDIT: removed the xGauges.bas file.
The xGauges thread has been updated in the first post.
 
Last edited:
  • Like
Reactions: zak
Upvote 0
Top