iOS Question custom list view height (and width)

Albi

Active Member
Licensed User
Longtime User
Hello,

I have a custom list view and when I select one of the items, it goes to page5 with a customListView (clv3a).

height
I have a case statement for deciding what to populate clv3a with. Once the text is set (textDesc as string), I use the following code to populate the clv:

B4X:
    clv3a.Initialize(Me, "clv3a", 100%x)
    Page5.rootPanel.AddView(clv3a.AsView,0,40,100%x,100%y)
    clv3a.AddTextItem(txtDesc, 1)

However, when it is created, if it is larger than the previous text that was the there, the label height is the same height as it was previously. If I go back and into it again, it is now the right height.
It still scrolls fine, so the content height is set ok.
I took logs of the label height and contentheight within the custom class and they matched up, both when it was the 'wrong' height and the right height!

I tried adding this to the bottom of the code above hoping that would fix it but it did not.

B4X:
    clv3a.Clear
    clv3a.AddTextItem(txtDesc, 1)

any ideas what to try?

i'd rather not upload the whole project as i'm making it for someone else, but obv will if it's really necessary!

width
with regards to the width, if i initialise it as follows:
B4X:
    clv3a.Initialize(Me, "clv3a", 100%x-20)
    Page5.rootPanel.AddView(clv3a.AsView,10,40,100%x,100%y)
    clv3a.AddTextItem(txtDesc, 1)

so that the clv has some slight borders with the edge of the page, it doesn't resize the content width and some text is cropped from the right hand side, within the view. i tried
B4X:
    clv3a.Initialize(Me, "clv3a", 100%x-20)
    Page5.rootPanel.AddView(clv3a.AsView,10,40,100%x-20,100%y)
    clv3a.AddTextItem(txtDesc, 1)

but that resized the view every time i went back into it making it smaller and smaller each time...

thanks for any help!
 

Albi

Active Member
Licensed User
Longtime User
mwe attached.
if you go to the third tab (it's a tableview), and choose the 1st option, the clv text will be the right size. then if you go back and choose 2nd or 3rd option, you'll see the clv text is the wrong size (but it scrolls nicely!). Go back and then into the same option, and it will be the perfect size.

line 159
B4X:
Page5.rootPanel.AddView(clv3a.AsView,0,40,100%x,100%y)
was where i tried to adjust the left to 10 and have the width as 100%x-20 but then it didn't fit in the page horizontally.

thanks!
 

Attachments

  • CLV MWE.zip
    70.4 KB · Views: 256
Upvote 0

Albi

Active Member
Licensed User
Longtime User
thanks for the reply, that worked nicely.

and i do need to work on coding organization (lack of) skills!
 
Upvote 0
Top