iOS Question Scrollview, adding multiple labels

cooperlegend

Active Member
Licensed User
Longtime User
I have copied my code from b4a for taking eight name labels (defined in the designer as four labels on top of four other labels) and moving them into a scrollview so the list of eight names scrolls with a smaller area than needed for eight.

I converted RemoveView to RemoveViewFromParent

B4X:
       lblName1.RemoveViewFromParent
        lblName2.RemoveViewFromParent
        lblName3.RemoveViewFromParent
        lblName4.RemoveViewFromParent
        lblName5.RemoveViewFromParent
        lblName6.RemoveViewFromParent
        lblName7.RemoveViewFromParent
        lblName8.RemoveViewFromParent
      
        scrollNames.Panel.AddView(lblName1, lblName1.Left, lblName1.Top - scrollNames.Top, lblName1.Width, lblName1.Height)
        scrollNames.Panel.AddView(lblName2, lblName2.Left, lblName2.Top - scrollNames.Top, lblName2.Width, lblName2.Height)
        scrollNames.Panel.AddView(lblName3, lblName3.Left, lblName3.Top - scrollNames.Top, lblName3.Width, lblName3.Height)
        scrollNames.Panel.AddView(lblName4, lblName4.Left, lblName4.Top - scrollNames.Top, lblName4.Width, lblName4.Height)
        scrollNames.Panel.AddView(lblName5, lblName5.Left, lblName5.Top - scrollNames.Top + scrollNames.Height, lblName5.Width, lblName5.Height)
        scrollNames.Panel.AddView(lblName6, lblName6.Left, lblName6.Top - scrollNames.Top + scrollNames.Height, lblName6.Width, lblName6.Height)
        scrollNames.Panel.AddView(lblName7, lblName7.Left, lblName7.Top - scrollNames.Top + scrollNames.Height, lblName7.Width, lblName7.Height)
        scrollNames.Panel.AddView(lblName8, lblName8.Left, lblName8.Top - scrollNames.Top + scrollNames.Height, lblName8.Width, lblName8.Height)
ContentHeight is defined as twice scrollNames.Height in the designer.

In debug I can see the labels being created in the correct places, but once the screen has drawn I get to see just four labels in the centre of the scrollView ?!?!?

Any ideas?
 
Last edited:

cooperlegend

Active Member
Licensed User
Longtime User
Hi Erel,

I would rather not share my whole project, too much company sensitive code :)

I could perhaps email under NDA.

John
 
Upvote 0

cooperlegend

Active Member
Licensed User
Longtime User
Thanks, OK, I have knocked together a demo. This is has the same sort of issue as above, this one does not show any of the names...
 

Attachments

  • test.zip
    3 KB · Views: 283
Upvote 0

cooperlegend

Active Member
Licensed User
Longtime User
Thanks Erel,

Sorry about that, silly error, I now attach the same with the alpha set to 1. You will now see the real issue that I started the forum for :)

Any ideas why only four labels are shown on this one?

John
 

Attachments

  • test.zip
    3 KB · Views: 294
Upvote 0

cooperlegend

Active Member
Licensed User
Longtime User
Problem seems to be when I addview...

Even doing this below, never places it anywhere but around two lines down from the top ?

scrollStarts.Panel.AddView(lblStart1, 0, 0, 100, 100)

Is this a bug?

p.s. Other than a few small issues, B4i is working great for me, many thanks for bringing this out :)
 
Upvote 0
Top