Marco Maria Vilucchi Active Member Licensed User Longtime User Dec 6, 2017 #1 Hi all, I need to create a panel by code. In this panel i must put some labels. I'll get the text for the labels from a DB (in this case is a MySql in the web). Then I don't know how many characters has the text or how many rows it needs. Thi is the code: B4X: Activity.AddView(pnl1,0,0,100%x,100%y) pnl1.Panel.AddView(lb1, 0, 0, 100%x, lb1h) pnl1.Panel.AddView(lb2, 0, lb1h, 100%x, lb2h) lb2 must start at the end of lb1. But how can I know lb1h? There is a way to calculate this number? Thanks in advance Marco
Hi all, I need to create a panel by code. In this panel i must put some labels. I'll get the text for the labels from a DB (in this case is a MySql in the web). Then I don't know how many characters has the text or how many rows it needs. Thi is the code: B4X: Activity.AddView(pnl1,0,0,100%x,100%y) pnl1.Panel.AddView(lb1, 0, 0, 100%x, lb1h) pnl1.Panel.AddView(lb2, 0, lb1h, 100%x, lb2h) lb2 must start at the end of lb1. But how can I know lb1h? There is a way to calculate this number? Thanks in advance Marco
Erel B4X founder Staff member Licensed User Longtime User Dec 6, 2017 #2 Tip: you can use CustomListView.AddText to add a scrollable label with the correct height. Check StringUtils.MeasureMultilineText Upvote 0
Tip: you can use CustomListView.AddText to add a scrollable label with the correct height. Check StringUtils.MeasureMultilineText
Marco Maria Vilucchi Active Member Licensed User Longtime User Dec 6, 2017 #3 ok thanks Last edited: Dec 6, 2017 Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 6, 2017 #4 There are several mistakes in this code: 1. Never use a number without units for dimensions. 2. There is no such thing as 100%. What is the output of Log(su.MeasureMultilineTextHeight(lbl, lbl.Text))? Have you tried CustomListView? Upvote 0
There are several mistakes in this code: 1. Never use a number without units for dimensions. 2. There is no such thing as 100%. What is the output of Log(su.MeasureMultilineTextHeight(lbl, lbl.Text))? Have you tried CustomListView?