Android Question [B4X] BBListItem - BCTextEngine inside CLV (Help please)

joko0124

Member
Licensed User
Longtime User
Hello! Can anybody help me with my problem regarding bblistitem?
When I comment blocked line 13-14 it will run with no error, but it doesn't show the content (see attachment)
And removing comments from this line got an error (see attachment)

B4X:
Private Sub clvFAQs_ScrollChanged (Offset As Int)
    For i = 0 To clvFAQs.Size - 1
        Dim pnl As B4XView = clvFAQs.GetPanel(i)
'        Log(pnl.GetView(0).NumberOfViews)
'        If pnl.GetView(0).NumberOfViews > 0 Then
'        For j = 0 To pnl.GetView(0).NumberOfViews - 1
'            Dim mView As View
'            mView = pnl.GetView(j)
'            Log(GetType(mView))
'        Next
'        End If
        If pnl.NumberOfViews = 0 Then Return
        Dim BB As BBListItem = pnl.GetView(1).GetView(1).GetView(BBListItemIndexInItems).Tag
        BB.ParentScrolled(Offset, clvFAQs.GetRawListItem(i).Offset, clvFAQs.AsView.Height, pnl.GetView(0).Height)
    Next

End Sub

Additional info... I am using two layouts
1 for category and 2 for the contents.
 

Attachments

  • error.jpg
    error.jpg
    156.2 KB · Views: 157
  • CLVExpandable.gif
    CLVExpandable.gif
    293.9 KB · Views: 153

William Lancee

Well-Known Member
Licensed User
Longtime User
The first thing you should do is find out what is in the panel. Maybe there is only one view (at index 0).

B4X:
'        Dim BB As BBListItem = pnl.GetView(1).GetView(1).GetView(BBListItemIndexInItems).Tag
'        BB.ParentScrolled(Offset, clvFAQs.GetRawListItem(i).Offset, clvFAQs.AsView.Height, pnl.GetView(0).Height)
For i = 0 to pnl.NumberOfViews - 1
    log(getType(pnl.GetView(i)) & TAB & pnl.GetView(i).NumberOfViews )
Next
 
Upvote 0

joko0124

Member
Licensed User
Longtime User
The first thing you should do is find out what is in the panel. Maybe there is only one view (at index 0).

B4X:
'        Dim BB As BBListItem = pnl.GetView(1).GetView(1).GetView(BBListItemIndexInItems).Tag
'        BB.ParentScrolled(Offset, clvFAQs.GetRawListItem(i).Offset, clvFAQs.AsView.Height, pnl.GetView(0).Height)
For i = 0 to pnl.NumberOfViews - 1
    log(getType(pnl.GetView(i)) & TAB & pnl.GetView(i).NumberOfViews )
Next
It hangs the app, but I get your point - it returns "anywheresoftware.b4a.BALayout 3" on the logs. Please see on attachment my layout.
 

Attachments

  • layout.jpg
    layout.jpg
    145.5 KB · Views: 129
Upvote 0

joko0124

Member
Licensed User
Longtime User
The first thing you should do is find out what is in the panel. Maybe there is only one view (at index 0).

B4X:
'        Dim BB As BBListItem = pnl.GetView(1).GetView(1).GetView(BBListItemIndexInItems).Tag
'        BB.ParentScrolled(Offset, clvFAQs.GetRawListItem(i).Offset, clvFAQs.AsView.Height, pnl.GetView(0).Height)
For i = 0 to pnl.NumberOfViews - 1
    log(getType(pnl.GetView(i)) & TAB & pnl.GetView(i).NumberOfViews )
Next
Already did this, but I couldn't figure how to get the my BBListItem1 object. ?
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
So now you know that getView(0) is a layout.

Next,
B4X:
Dim bx as B4XView = pnl.GetView(0)
log(getType(bx).GetView(0) & TAB & bx.NumberOfViews )
 
Last edited:
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
I am in a different time zone, so I didn't respond.
The link you posted is for a game. Not a small sample source program.

Write a small program that includes only the code and layout that causes the error, zip it and attach the zip file
to this thread.

I would need this for me to help you.

But you could find the problem yourself by tracking the tree of nodes in the CLV panels.
1. get the number of views of a view
2. iterate through them and see what they are (use try block to avoid crashes)

Repeat recursively if necessary.

Note: Avoid appealing to individual members for help.
(I mentioned @Mahares in jocular way, with deep respect for his skills with CLV)
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Can anybody help me with my problem regarding bblistitem
I could not follow your project, so based on a project I made a while back featuring xClv expanded and BBListItems, I used your database and your data in the attached project. It does a lot of what you want to do. Hopefully, when you run it you will be able to figure out what is causing the issue in your own project. Please note that I added a couple of methods to the CLVExpandable class that allows for expanding all or collapsing all with one button click. They are both marked by ‘Mahares’ next to them.
Thank you @William Lancee for the compliment, but you have forgotten more than I will ever know"
1697914221604.png



1697914347352.png
 

Attachments

  • BBListItemCLVExpandedSQLite.zip
    280 KB · Views: 149
Upvote 0

Alain75

Member
Hello! Can anybody help me with my problem regarding bblistitem?
When I comment blocked line 13-14 it will run with no error, but it doesn't show the content (see attachment)
And removing comments from this line got an error (see attachment)

B4X:
Private Sub clvFAQs_ScrollChanged (Offset As Int)
    For i = 0 To clvFAQs.Size - 1
        Dim pnl As B4XView = clvFAQs.GetPanel(i)
'        Log(pnl.GetView(0).NumberOfViews)
'        If pnl.GetView(0).NumberOfViews > 0 Then
'        For j = 0 To pnl.GetView(0).NumberOfViews - 1
'            Dim mView As View
'            mView = pnl.GetView(j)
'            Log(GetType(mView))
'        Next
'        End If
        If pnl.NumberOfViews = 0 Then Return
        Dim BB As BBListItem = pnl.GetView(1).GetView(1).GetView(BBListItemIndexInItems).Tag
        BB.ParentScrolled(Offset, clvFAQs.GetRawListItem(i).Offset, clvFAQs.AsView.Height, pnl.GetView(0).Height)
    Next

End Sub

Additional info... I am using two layouts
1 for category and 2 for the contents.
According to me, to get the views of a panel, you just have to code :
B4X:
...
Dim pnl As B4XView = clvFAQs.GetPanel(i)
For Each v As View Inpnl.GetAllViewsRecursive
   [I]code for each view of the panel[/I]
Next
 
Upvote 0

joko0124

Member
Licensed User
Longtime User
I am in a different time zone, so I didn't respond.
The link you posted is for a game. Not a small sample source program.

Write a small program that includes only the code and layout that causes the error, zip it and attach the zip file
to this thread.

I would need this for me to help you.

But you could find the problem yourself by tracking the tree of nodes in the CLV panels.
1. get the number of views of a view
2. iterate through them and see what they are (use try block to avoid crashes)

Repeat recursively if necessary.

Note: Avoid appealing to individual members for help.
(I mentioned @Mahares in jocular way, with deep respect for his skills with CLV)
I appreciate your response to my question. I was very grateful for it.
Noted on your advices. Thank you!
 
Upvote 0

joko0124

Member
Licensed User
Longtime User
I could not follow your project, so based on a project I made a while back featuring xClv expanded and BBListItems, I used your database and your data in the attached project. It does a lot of what you want to do. Hopefully, when you run it you will be able to figure out what is causing the issue in your own project. Please note that I added a couple of methods to the CLVExpandable class that allows for expanding all or collapsing all with one button click. They are both marked by ‘Mahares’ next to them.
Thank you @William Lancee for the compliment, but you have forgotten more than I will ever know"
View attachment 147066


View attachment 147067
Thank you so much for your response! Thank you for using my database on your sample. I'll try to study your code. ??
 
Upvote 0
Top