B4J Question CustomView load and access

madru

Active Member
Licensed User
Longtime User
Hello,

I have build a custom view, on this view I placed several components like Labels, Choisebox , Progressbar and a CircularProgressBar.

1578577871131.png


I can access all components after loading the View but not the CustomView CircularProgressbar.

B4X:
    Dim items As List = Array("A","B","C")
    
    For Each S As String In items
        Dim P As B4XView = XUI.CreatePanel("")
        P.Height = 25
        P.LoadLayout("Testing")

        For Each v As B4XView In p.GetAllViewsRecursive
            Log(v)
        Next
        
        P.GetView(0).Text = items.Get(0)
        P.GetView(1).Text = items.Get(1)
        P.GetView(2).Text = items.Get(2)
        
        Dim CB As ChoiceBox = P.GetView(3)
        CB.Items.AddAll(Array("","a","b","c","d","e"))
            
        Dim PB As ProgressBar = P.GetView(4)
        PB.Progress=0.4
        
        Dim CPB As CircularProgressBar = P.GetView(5) ' how??
        
        SelectionList1.Add(P,S)
    Next

If I dump out all components I can not see the CustomView component(s) I only get a 'NonResizePane', Canvas and Label

B4X:
(Label) Label@11ce656c[styleClass=label]'Text1'
(Label) Label@7fcfc37a[styleClass=label]'Text2'
(Label) Label@61b43b31[styleClass=label]'Text3'
(ChoiceBox) ChoiceBox@60687cfd[styleClass=choice-box]
(ProgressBar) ProgressBar@7ecf7d98[styleClass=progress-bar]
(NonResizePane) PaneWrapper$ConcretePaneWrapper$NonResizePane@5f4aedad
(Canvas) Canvas@43208fcf
(Canvas) Canvas@1da57447
(Label) Label@4753b7b1[styleClass=label]'0'
how can I access those CustomView components ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
 
Upvote 0

madru

Active Member
Licensed User
Longtime User
I looked into the mentioned thread, but I have to say that I don't get it :(
.....yes it does work for B4XComboBox, B4XSwitch etc but not for my self-made or the CircularProgressbar CustomView.
I really hope I overlooked the important part in the explanation :)

can somebody make this tiny example work ?
 

Attachments

  • test.zip
    3.7 KB · Views: 168
Upvote 0
Top