Elric Well-Known Member Licensed User Apr 11, 2022 #1 Hello everybody! I'd like to manage the text in the clv panel. No problem to change the Textcolor. Code: Copy clv1.GetPanel(0).GetView(0).TextColor = xui.Color_Red 2 problems: Problem no. 1 I cannot manage Textsize and xui.CreateDefaultBoldFont. This code doesn't work: Code: Copy clv1.GetPanel(0).GetView(0).Font = xui.CreateDefaultBoldFont(clv1.GetPanel(0).GetView(0).TextSize) clv1.GetPanel(0).GetView(0).TextSize = 50 This is quite strange just because Textcolor does it... The only solution seems Code: Copy clv1.GetPanel(0).GetView(0).As(Node).Style = "" . With this command Textsize and xui.CreateDefaultBoldFont works. Problem no. 2 If the only solution is the above, how I can reset the height of the single row to fit automatically with the text lenght? In particular, sometimes when normal text will set bold may happens that a new line is needed. How to solve it? Thank you! Attachments CustomListViewTextSizeandBoldfont.zip CustomListViewTextSizeandBoldfont.zip 12 KB · Views: 403
Hello everybody! I'd like to manage the text in the clv panel. No problem to change the Textcolor. Code: Copy clv1.GetPanel(0).GetView(0).TextColor = xui.Color_Red 2 problems: Problem no. 1 I cannot manage Textsize and xui.CreateDefaultBoldFont. This code doesn't work: Code: Copy clv1.GetPanel(0).GetView(0).Font = xui.CreateDefaultBoldFont(clv1.GetPanel(0).GetView(0).TextSize) clv1.GetPanel(0).GetView(0).TextSize = 50 This is quite strange just because Textcolor does it... The only solution seems Code: Copy clv1.GetPanel(0).GetView(0).As(Node).Style = "" . With this command Textsize and xui.CreateDefaultBoldFont works. Problem no. 2 If the only solution is the above, how I can reset the height of the single row to fit automatically with the text lenght? In particular, sometimes when normal text will set bold may happens that a new line is needed. How to solve it? Thank you!
Erel B4X founder Staff member Licensed User Longtime User Apr 13, 2022 #2 If all items use the same text setting then you should do it with the designer. Simply set the text properties of the CLV. If you want to add items with different settings then modify CLV.DesignerLabel before you add the item with CLV.AddTextItem: Code: Copy CLV.DesignerLabel.Style = "" CLV.DesignerLabel.As(B4XView).Font = ... CLV.AddTextItem(...) Upvote 0
If all items use the same text setting then you should do it with the designer. Simply set the text properties of the CLV. If you want to add items with different settings then modify CLV.DesignerLabel before you add the item with CLV.AddTextItem: Code: Copy CLV.DesignerLabel.Style = "" CLV.DesignerLabel.As(B4XView).Font = ... CLV.AddTextItem(...)
Elric Well-Known Member Licensed User Apr 14, 2022 #3 Thank you! I'd like to change it at run-time. I'm working on a "choose the right answear" so: for the first question I'd like to highlight the correct answear and, then, go to second question, I'd like to reset going back to plain text and, again, highlight the right anwear and, then, go to third question and so go on. Maybe it's more simple, use one clv for one answear? Upvote 0
Thank you! I'd like to change it at run-time. I'm working on a "choose the right answear" so: for the first question I'd like to highlight the correct answear and, then, go to second question, I'd like to reset going back to plain text and, again, highlight the right anwear and, then, go to third question and so go on. Maybe it's more simple, use one clv for one answear?
Erel B4X founder Staff member Licensed User Longtime User Apr 14, 2022 #4 You can change it at runtime. Simply set the DesignerLabel font before you add the item. Another option is to use CSBuilder, however the text measurement will not be 100% accurate. Upvote 0
You can change it at runtime. Simply set the DesignerLabel font before you add the item. Another option is to use CSBuilder, however the text measurement will not be 100% accurate.
Elric Well-Known Member Licensed User Apr 29, 2022 #5 Thank you! (sorry for late answear!) Erel said: Another option is to use CSBuilder, however the text measurement will not be 100% accurate. Click to expand... I knew that CSBuilder was not on B4J... was it? Erel said: You can change it at runtime. Simply set the DesignerLabel font before you add the item. Click to expand... If I understood correctly, in the case I've already add the item, to change such item I need to remove it and add it again? Last edited: Apr 29, 2022 Upvote 0
Thank you! (sorry for late answear!) Erel said: Another option is to use CSBuilder, however the text measurement will not be 100% accurate. Click to expand... I knew that CSBuilder was not on B4J... was it? Erel said: You can change it at runtime. Simply set the DesignerLabel font before you add the item. Click to expand... If I understood correctly, in the case I've already add the item, to change such item I need to remove it and add it again?
Erel B4X founder Staff member Licensed User Longtime User May 1, 2022 #6 Elric said: I knew that CSBuilder was not on B4J... was it? Click to expand... No. Elric said: If I understood correctly, in the case I've already add the item, to change such item I need to remove it and add it again? Click to expand... No. Either set the style to "" or set the style of DesignerLabel to "" before you add the items. Upvote 0
Elric said: I knew that CSBuilder was not on B4J... was it? Click to expand... No. Elric said: If I understood correctly, in the case I've already add the item, to change such item I need to remove it and add it again? Click to expand... No. Either set the style to "" or set the style of DesignerLabel to "" before you add the items.
Elric Well-Known Member Licensed User May 1, 2022 #7 Thank you! So, first of all: B4X: Copy Private Sub B4XPage_Created (Root1 As B4XView) '...[other code]... clv1.DesignerLabel.Style = "" clv2.DesignerLabel.Style = "" '...[other code]... End Sub Then add items: B4X: Copy '...[other code]... clv1.AddTextItem(strString, strString) clv1.AddTextItem(strString, strString) clv1.AddTextItem(strString, strString) '...[other code]... Then I can change them: B4X: Copy '...[other code]... clv1.GetPanel(0).GetView(0).TextColor = xui.Color_Red clv1.GetPanel(0).GetView(0).TextSize = 20 clv1.GetPanel(0).GetView(0).Font = xui.CreateDefaultBoldFont(20) '...[other code]... I've used Code: Copy clv1.GetPanel(0).GetView(0).Font instead of Code: Copy CLV.DesignerLabel.As(B4XView).Font to change only one item. I think is correct, doesn't it? Here attached my example. I've a question about the reset panel height in CLV and why does work properly neither with plain text nor with bold text but I think I should open a new thread about that. Attachments CustomListViewTextSizeandBoldfont.zip CustomListViewTextSizeandBoldfont.zip 13.4 KB · Views: 432 Last edited: May 1, 2022 Upvote 0
Thank you! So, first of all: B4X: Copy Private Sub B4XPage_Created (Root1 As B4XView) '...[other code]... clv1.DesignerLabel.Style = "" clv2.DesignerLabel.Style = "" '...[other code]... End Sub Then add items: B4X: Copy '...[other code]... clv1.AddTextItem(strString, strString) clv1.AddTextItem(strString, strString) clv1.AddTextItem(strString, strString) '...[other code]... Then I can change them: B4X: Copy '...[other code]... clv1.GetPanel(0).GetView(0).TextColor = xui.Color_Red clv1.GetPanel(0).GetView(0).TextSize = 20 clv1.GetPanel(0).GetView(0).Font = xui.CreateDefaultBoldFont(20) '...[other code]... I've used Code: Copy clv1.GetPanel(0).GetView(0).Font instead of Code: Copy CLV.DesignerLabel.As(B4XView).Font to change only one item. I think is correct, doesn't it? Here attached my example. I've a question about the reset panel height in CLV and why does work properly neither with plain text nor with bold text but I think I should open a new thread about that.