textLabel.Text ... stripping spaces from text

Post Reply
User avatar
grayghost4
Posts: 27
Joined: Wednesday 05th December 2018 5:00am
Location: Concord, CA usa

textLabel.Text ... stripping spaces from text

Post by grayghost4 » Saturday 19th January 2019 12:37am

Is this a feature or a bug :D

spaces have been stripped from the text.
Attachments
text label example.png
text label example.png (45.05 KiB) Viewed 373 times

User avatar
Quincunxian
Posts: 40
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

Re: textLabel.Text ... stripping spaces from text

Post by Quincunxian » Saturday 19th January 2019 2:54am

The TextLabel control displays text more like a html page and can have embedded (simple) html code such as...
<p>...</p> <br> <b>...</b> <h2>...</h2>

I'd suspect that this is a 'feature' as its really the end result of however the html parser works in Gambas.

I tried this and it will embed 10 X spaces in a string...
TextLabel1.Text = "test" & String(10, "&nbsp;") & "test"

The other option is to use a standard label where there is no additional formatting.
Cheers - Quin.
I code therefore I am

User avatar
grayghost4
Posts: 27
Joined: Wednesday 05th December 2018 5:00am
Location: Concord, CA usa

Re: textLabel.Text ... stripping spaces from text

Post by grayghost4 » Saturday 19th January 2019 4:32am

thank you for the response and suggestions
now I see what the difference between Label and a Textlabel

I do have a lot to learn ... I hope I am not a pest

stevedee
Posts: 110
Joined: Monday 20th March 2017 6:06pm

Re: textLabel.Text ... stripping spaces from text

Post by stevedee » Saturday 19th January 2019 11:26am

grayghost4 wrote:
Saturday 19th January 2019 4:32am
... I hope I am not a pest
We don't allow pests on this forum...only people with a desire to understand what-on-earth is happening to their Gambas code!

Keep 'um coming!


Yes, html is designed to remove any surplus white space (e.g. multiple spaces between characters) although you can still use Tabs in a TextLabel.

didier18
Posts: 38
Joined: Monday 19th December 2016 10:08pm

Re: textLabel.Text ... stripping spaces from text

Post by didier18 » Saturday 19th January 2019 2:25pm

Hello

To make a comparison, there is also this possibility:

Code: Select all

Public Sub Form_Open()

  Label1.Caption = "Welcome" & Space(7) & "gambas3"
  TextLabel1.Caption = "Welcome" & "\t" & "gambas3"

End
Have a good day.

User avatar
grayghost4
Posts: 27
Joined: Wednesday 05th December 2018 5:00am
Location: Concord, CA usa

Re: textLabel.Text ... stripping spaces from text

Post by grayghost4 » Saturday 19th January 2019 3:49pm

Thanks for the help
The only one I have been able to get to works is :

String(5, "&nbsp;")

Which at this time is all that I need.

Post Reply