Pflichtfeld Active Member Licensed User May 10, 2020 #1 It is possible, to pass a csbuilder-object to the text-parameter of a canvas.drawtext. But its colors are overwritten by the color-parameter of the drawtext-method. It is not accepted, to pass anything else then an int for the color-parameter. Is there a way, to get the colors of the csbuilder-object in drawtext of canvas?
It is possible, to pass a csbuilder-object to the text-parameter of a canvas.drawtext. But its colors are overwritten by the color-parameter of the drawtext-method. It is not accepted, to pass anything else then an int for the color-parameter. Is there a way, to get the colors of the csbuilder-object in drawtext of canvas?
Erel B4X founder Staff member Licensed User Longtime User May 11, 2020 #2 Canvas.DrawText doesn't work with CSBuilder. I don't know what you are trying to do but you should check BBCodeView. Upvote 0
Canvas.DrawText doesn't work with CSBuilder. I don't know what you are trying to do but you should check BBCodeView.
Pflichtfeld Active Member Licensed User May 11, 2020 #3 Erel said: I don't know what you are trying to do but you should check BBCodeView. Click to expand... Thank you Erel, I wanted to display severel numbers in one line in different colors in a drawing. Did it now with canvas.measuretext. Upvote 0
Erel said: I don't know what you are trying to do but you should check BBCodeView. Click to expand... Thank you Erel, I wanted to display severel numbers in one line in different colors in a drawing. Did it now with canvas.measuretext.
Erel B4X founder Staff member Licensed User Longtime User May 11, 2020 #4 Another option is to set Label.Text and then draw it with Label.Snapshot (set the label type to B4XView). Upvote 0
Another option is to set Label.Text and then draw it with Label.Snapshot (set the label type to B4XView).
Erel B4X founder Staff member Licensed User Longtime User May 12, 2020 #6 See TextToBitmap: https://www.b4x.com/android/forum/threads/drawing-multiline-text.103845/#content Upvote 0
Pflichtfeld Active Member Licensed User May 12, 2020 #7 Perfect! Thank you! May I ask you a question about the given example? B4X: Sub TextToBitmap (Width As Int, Fnt As B4XFont, Clr As Int, Text As Object) As B4XBitmap Dim lbl As Label lbl.Initialize("") Dim x As B4XView = lbl 1. are the lines: B4X: Dim lbl As Label lbl.Initialize("") cross-platform? 2. Would this also do? (but there is no initialize-Method for a b4xview) B4X: Sub TextToBitmap (Width As Int, Fnt As B4XFont, Clr As Int, Text As Object) As B4XBitmap Dim x As B4XView Upvote 0
Perfect! Thank you! May I ask you a question about the given example? B4X: Sub TextToBitmap (Width As Int, Fnt As B4XFont, Clr As Int, Text As Object) As B4XBitmap Dim lbl As Label lbl.Initialize("") Dim x As B4XView = lbl 1. are the lines: B4X: Dim lbl As Label lbl.Initialize("") cross-platform? 2. Would this also do? (but there is no initialize-Method for a b4xview) B4X: Sub TextToBitmap (Width As Int, Fnt As B4XFont, Clr As Int, Text As Object) As B4XBitmap Dim x As B4XView
DonManfred Expert Licensed User Longtime User May 12, 2020 #8 Pflichtfeld said: 2. Would this also do? Click to expand... no. You are not doing anything useful here. Upvote 0
Pflichtfeld said: 2. Would this also do? Click to expand... no. You are not doing anything useful here.
Pflichtfeld Active Member Licensed User May 12, 2020 #9 It seems that I have not understood this crossplattform topic: I thought that all the b4xviews are crossplatform and the 'normal' b4a-views are not. So I assumed, that B4X: Dim lbl As Label lbl.Initialize("") would not be crossplatform. Isn't that right? Upvote 0
It seems that I have not understood this crossplattform topic: I thought that all the b4xviews are crossplatform and the 'normal' b4a-views are not. So I assumed, that B4X: Dim lbl As Label lbl.Initialize("") would not be crossplatform. Isn't that right?
Erel B4X founder Staff member Licensed User Longtime User May 12, 2020 #10 1. Yes they are cross platform because Label type exists in all three platforms. 2. As @DonManfred wrote it is not doing anything. The view must be initialized and you can't initialize a B4XView directly as it is a wrapper for all types of views. Upvote 0
1. Yes they are cross platform because Label type exists in all three platforms. 2. As @DonManfred wrote it is not doing anything. The view must be initialized and you can't initialize a B4XView directly as it is a wrapper for all types of views.
Pflichtfeld Active Member Licensed User May 12, 2020 #11 Again a big step forward for me! Thank you Erel an DonManfred! Upvote 0