Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Text not showing as expected
Started by xapwing Nov 14 2018 06:33 AM

3 replies to this topic
newtext color
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

xapwing

[GLOBAL: userInfoPane.html]
xapwing
  • Observer

  • 3 posts
  • Corona SDK

Using this:

local aboutText = display.newText(options)
  grp:insert(aboutText)

the text does not show (on a white background).

But, using this:

local aboutText = display.newText(options)
  aboutText:setFillColor(red)
  grp:insert(aboutText)

it does show, but as black letters, not red ...

 

So, 2 questions:

1. why do I need to set the fillcolor in the first place?

2. why is the text not in red?

 

TIA,

   /Arie



[TOPIC: post.html]
#2

xapwing

[GLOBAL: userInfoPane.html]
xapwing
  • Observer

  • 3 posts
  • Corona SDK

OK. Digging deeper I found out that in setFillColor you can't use ready made constants like "black".

Instead, when using 3 values for RGB it does work.

 

Sorry for the noise. I'm a bit new here :)



[TOPIC: post.html]
#3

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,380 posts
  • Corona SDK

That's cool.  Thanks for posting back when you worked it out.  This helps others in the same boat a lot.

 

Cheers and welcome to the community.

 

- Ed (aka RoamingGamer)



[TOPIC: post.html]
#4

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,997 posts
  • Corona SDK

The default simulator background is black and as such the default text is white. When you make your background white, you effectively are drawing white on white and can't see it. Using :setFillColor() is the correct thing to do. But you can also set the default color for display objects using display.setDefault(). See: http://docs.coronalabs.com/api/library/display/setDefault.html

 

Rob




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: newtext, color