TextArea Colour Question.
Posted
#1
(In Topic #1594)
Regular

so my question is pretty simple,
is there a way to colour the text in a textArea box
i'm making a search feature (what works perfect)
but i want to maybe change the size of "Result(s) ; " & "\n"
maybe make it bold / underlined, maybe change the colour to red or something.
i can't seem to find any documentation for it.
Posted
Enthusiast

textlabel.text="This is normal text. <b> this is bold </b> and this <font color=" & chr(34) & "FF0000" & chr(34) & "> is my red. </font>"
not sure if the chr(34) which is a quote is needed or not. but that would be HTML coding for what you see.
Posted
Regular

but gambas 3 says TextArea (gb.gui)
thats what i use. but yeah,
i tried html code with textlabels and such with no results, i think i'd need to throw it though a html viewer.
but i'll try again.
but your textabel.text=..
is how i want to do it, just change parts of the results and colour, not the entire thing.
Posted
Guru

JMathers said
yeah, i wanted to avoid using html coding
but gambas 3 says TextArea (gb.gui)
thats what i use. but yeah,
i tried html code with textlabels and such with no results, i think i'd need to throw it though a html viewer.
but i'll try again.
but your textabel.text=..
is how i want to do it, just change parts of the results and colour, not the entire thing.
html code (or RichText to be more accurate) With a RichText compliant Control like TextLabel is the only simple way really.
unless you want to use markdown then gb.markdown can convert that to html with a HtmlView
RichText is quite limited compaired to full html though.
Don't let the word Text in TextLabel and TextArea confuse you, they are different things.
TextArea is just a multi line TextBox, it basically has what a TextBox has in features.
TextLabel is a Label that supports RichText. (plus some nice Border options)
sadams54 was correct but missed the # hash for RGB hexidecimal like #FF0000
(quotes are not needed)
you can also use basic html color names like red yellow magenta etc
Example…
Code (gambas)
- TextLabel1.Text = "Hi <font color=red>this is red text</font> and also "
- "<font size=+2><b>big and bold</b></font> or "
- "<font color=#00FF00>green text using #RRGGBB</font>"
Posted
Regular

i tried that 1, but i couldn't work out how to make it go multi-lined.
so i abandoned it for the time in search for a multi lined option.
i tried \n , and chr(13) & chr(10) and looked for a .multi or something.
but the textlabel it doesn't so..yeah :?:
JM
Posted
Administrator

Try:JMathers said
hi Bruce.
i tried that 1, but i couldn't work out how to make it go multi-lined.
so i abandoned it for the time in search for a multi lined option.
i tried \n , and chr(13) & chr(10) and looked for a .multi or something.in the textarea1 it works perfectly
but the textlabel it doesn't so..yeah :?:
JM
Code
<br>Think RichText, not Plain Text
gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
Posted
Guru

line break with either the "line break" tag <br>
or the paragraph tag <p>
Code (gambas)
- TextArea1.Text = "<b>Search Result</b> ;<br><br>" & resultText
Code (gambas)
- TextArea1.Text = "<b>Search Result</b> ;<p>" & resultText
Posted
Regular

BruceSteers said
yes RichText is like cut down HTML you can only use <HTML> tags for text formatting.
line break with either the "line break" tag <br>
or the paragraph tag <p>Code (gambas)
TextArea1.Text = "<b>Search Result</b> ;<br><br>" & resultTextCode (gambas)
TextArea1.Text = "<b>Search Result</b> ;<p>" & resultText
S.O.B.. @£$*£(***..
Thank you BruceSteers <3 <3 <3 <3 <3 <3
@devs
how about adding a bit on build in information. on all these different styles when formatting these. :!:
Posted
Administrator

How about you doing some more effort in searching for things?JMathers said
how about adding a bit on build in information. on all these different styles when formatting these. :!:
I typed 'gambas wiki rich text ' in a search engine and got what the devs wrote on gambas wiki: https://gambaswiki.org/wiki/doc/richtext
gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories
… there is always a Catch if things go wrong!
Posted
Guru

gbWilly said
How about you doing some more effort in searching for things?JMathers said
how about adding a bit on build in information. on all these different styles when formatting these. :!:
I typed 'gambas wiki rich text ' in a search engine and got what the devs wrote on gambas wiki: https://gambaswiki.org/wiki/doc/richtext
He's Right though JMathers, the wiki page for the TextLabel has a link to the RichText info page https://gambaswiki.org/wiki/doc/richtext
It's technically no longer gambas help
It's a little HTML understanding.
I just added some more info to the gambas wiki but if not logged in it will not show till tomorrow.
Posted
Regular

thanks for the URL, i book marked it. :!:
Posted
Guru

JMathers said
interesting. every time i do a search i don't get results like that
thanks for the URL, i book marked it. :!:
Perhaps if you used the gambas wiki more it will begin to show as a higher priority in your search result algorithms ?
The wiki is the go-to place for information.
It is also the source of the gambas IDE inline help popups.
/ - Gambas Documentation
We can be a bit "RTFM!" here as many of us have contributed to the wiki (like me adding that info yesterday)
If you're going to learn gambas that's the start point, the built-in reference manual.
It takes a little time to get used to it's layout but the main places to recommend are…
Language Index, Language overviews
Native classes , GUI classes
Then Components
Another way to open the wiki in the IDE is to press F1 or click the "? / Help browser" menu item
Posted
Regular

1 guest and 0 members have just viewed this.



