Text Label formatting

Post

Posted
Rating:
#1 (In Topic #959)
Avatar
Expert
Quincunxian is in the usergroup ‘Expert’
Quincunxian is in the usergroup ‘Blogger’
Does anyone have an example of the syntax for text label formatting?
The gambas help gives this:

A rich text is a string using a subset of the HTML format.
The following HMTL markups are allowed:
<p> <br> <a> <font>
<b> <i> <s> <sub> <sup> <small> <tt> <u>
<h1> <h2> <h3> <h4> <h5> <h6>
The <font> markup understands the following attributes: face, color, and size.

What I want to do is change the text font colour.
I had assumed it would be something like this:

Code (gambas)

  1. TextLable.Text = "Standard Colour <font 'color:red'> Color Red</font>"
or

Code (gambas)

  1. TextLable.Text = "Standard Colour <font style='color:red'> Color Red</font>"
But it has no effect - so syntax is wrong.
Any examples appreciated.

Cheers - Quin.
I code therefore I am
Online now: No Back to the top

Post

Posted
Rating:
#2
Banned
 Either…

Normal color <font color=red>and red</font>

Or use CSS style inside one of the supported tags..

Normal color
<p style="color:red">
red paragraph
</p>
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Enthusiast
GrayGhost is in the usergroup ‘Enthusiast’
this works for me  :

Code (gambas)

  1.    Message(" <b> <font color='red'> Error number too large </font></b>", "Ok")
  2.  
Online now: No Back to the top

Post

Posted
Rating:
#4
Banned
Nope. I couldn't get style to work either.

 But …

Code (gambas)

  1. TextLabel1.Text = "normal text <font color=red>red text</font>"
  2.  
  3.  

Works okay
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Enthusiast
GrayGhost is in the usergroup ‘Enthusiast’
so I guess the Quotes are not needed  :D

This will get you any color you want :

Code (gambas)

  1.    Message(" <b> <font color=#00D000> Error number too large </font></b>", "Ok")
  2.  

they must be  disabled in reverse order, this will NOT work:

Code (gambas)

  1.    Message(" <b> <font color=#00D000> Error number too large </b></font>", "Ok")
  2.  
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Expert
Quincunxian is in the usergroup ‘Expert’
Quincunxian is in the usergroup ‘Blogger’
Thanks guys - Not sure what happened there, but the code from yesterday was not working and today it is  :roll:

Code (gambas)

  1.  
  2. GameText = "Game: <font color=red> " & AV.GameName & "</font>"
  3. GameText &= " - Player: <font color=yellow> " & AV.PlayerName & "</font>"
  4. GameText &= " - Mode: <font color=cyan> " & AV.DiffAry[AV.GameMode] & "</font>"
  5. Object.SetProperty(Ctrl, "Text", GameText)
  6.  

I'm passing the TextLabel by reference and thought that this may have something to do with it but apparently not.
*sigh*

Cheers - Quin.
I code therefore I am
Online now: No Back to the top
1 guest and 0 members have just viewed this.