CustomListView - A flexible list based on ScrollView

Status
Not open for further replies.

GMan

Well-Known Member
Licensed User
Longtime User
Can you see the correct results in the log ?
B4X:
Log(IP.Answer)
Log(IP.CompactAnswer)
lbl.Text=(IP.Answer) 'not working...
 

GMan

Well-Known Member
Licensed User
Longtime User
Did you also try:
B4X:
lbl.Text = IP.CompactAnswer
 

GMan

Well-Known Member
Licensed User
Longtime User
Maybe it helps when you redraw (invalidate) the Label after changing the text ?
 

ciprian

Active Member
Licensed User
Longtime User
Not even once.... i don't know what to try .... i'm gonna create a new threat with the project. Hoping someone will see the error.
I will come back in an hour.
 

tunderin

Member
Licensed User
Longtime User
As posted, the CustomListview displays white space below the list when the list is too short to fill the screen.

The white space below is actually the exposed underlying scrollview.

This behavior can be fixed by making the scrollview height follow the scrollview panel height (which is adjusted when items are added or removed). The scrollview height shouldn't exceed 100%Y or the list will not scroll.

In the CustomListView class, make changesto the two following subs:

To the RemoveAt sub, add the line sv.Height=sv.Panel.Height right after the line that adjusts sv.Panel.Height

To the InsertAt sub, add the line If sv.Panel.Height<100%y Then sv.Height=sv.Panel.Height right after the line that adjusts sv.Panel.Height
 
Last edited:

JForge

Member
Licensed User
Longtime User
I know that at the first post Erel has said that you can add a customlistview with the designer by adding a customview and changing its type to a customlistview, but in the designer the option to change that is grayed out.. Is that still possible to do?
 

tunderin

Member
Licensed User
Longtime User
The type is not changeable, you are interested in "Custom Type" near the bottom of the properties table but before you try to declare it, you must first prepare the CustomListview class to support the Customview feature.

In the CustomListview class, change the first line of the Initialze sub from:

B4X:
Public Sub Initialize (vCallback As Object, vEventName As String)


to:

B4X:
Public Sub Initialize (TargetModule As Object,EventName As String)


You'll notice that Eventname is already declared in Class Globals, change it to mEventname to avoid conflict. Remember to update two lines in the Panel_Click sub to mEventname

Change two lines in the Initialze sub to read:

B4X:
    mEventName = EventName
CallBack = TargetModule

Finally, add the following sub to the class

B4X:
Sub DesignerCreateView(Base As Panel, Lbl As Label, Props As Map)
End Sub

The class is ready.

With that, back in Designer, if you drop down the list next to Custom Type, you should now see CustomListview listed there. Select it.


Update:

In thinking a bit more about how CustomListview works, I now believe that it's going to require some re-tooling to make this work... I'll look at this again on Monday - my own project needs this too & sometime soon .
 
Last edited:

tunderin

Member
Licensed User
Longtime User
You do not need to modify CustomListView code. v1.10 already did it.

You should change the CustomType property in the designer. Not the Type property (I will fix the instructions in the first post...)

Thanks Erel!

I missed the class update & was still working with v1.01
 

JForge

Member
Licensed User
Longtime User
Thanks Erel!

Only thing is, when I click the dropdown for the CustomType is completely blank. Any idea there..?
 

JForge

Member
Licensed User
Longtime User
Here it is, for testing some basics I am using a listview as a placeholder

Thanks Erel!
 

Attachments

  • Test_Ground.zip
    8.6 KB · Views: 305

JForge

Member
Licensed User
Longtime User
::facepalm::

I can't believe I forgot to add it to that project!

I had added it to another app I'm making, and forgot to for this one...

THANKS EREL
 

JForge

Member
Licensed User
Longtime User
I hate to sound like a complete n00b here, but if I use the designer for a scroll view, and there are less items than it takes to fill the length of the CustomListView, it shows gray space at the bottom..

Is it possible to just make it black, or any other color for that matter..?
 
Status
Not open for further replies.
Top