Bug? xCustomListView - Panel -Child Parent visibility

ianmegan

Member
Licensed User
Hi,


Encountered interesting issue.

I added a CustomListView (xCustomListView) Control in one layout

Then I created a panel in a second layout and added one view (checkbox) to the panel and in the designer I made the panel the controls parent.


I then changed the Checkbox Control to a B4X view in the declarations of the module.

I then opened the form with layout1 and added a number of panels in the customListControl using layout2

When I came to access the controls on each panel in code they were not reachable. Listoutofbound error.
When I checked the only view in the panel was the panel itself.

When I went back into my second layout and made the Main the parent instead of the panel I could then access the controls from code.

The panel then showed 2 views

Here is the code snippet

Sub CheckAllItems(check As Boolean)

For i = 0 To clv1.GetSize - 1
Dim p As B4XView = clv1.GetPanel(i)
Log(p.NumberOfViews)

Dim ch As B4XView
ch = p.GetView(1)
'1 = a checkbox
ch.Checked = check
'
Next

End Sub

When the panel was the parent in designer then log(p.numberofviews) returned 1
when Main was the parent in the designer then log(p.numberofviews) returned 2

Should not the parent be the Panel?

Not a problem except for Anchoring Items may be harder

Many thanks


Ian

I'm using B4J 6.51
xCustomListView 1.63
and jXUI 1.80
 

ianmegan

Member
Licensed User
Thanks for replying - I know you are a busy man.

Here is an example project.

The clv on the left works fine. it has the check box set to parent main
the clv on the right is identical except that the check box is set to parent pane1

press select all below each the one on the right will raise an error

thanks

Ian
 

Attachments

  • bugunexpected.zip
    26.1 KB · Views: 239

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is no bug here.
In the right list the first child view is a pane and this pane has a checkbox as its child view.

So the correct code is:
B4X:
Dim ch As B4XView = p.GetView(0).GetView(0)
This will of course not work with the left list as the structure is different. Please start a new thread in the questions forum if it is not clear.
 
Top