Text Color

Hello, 

I can’t figure out how to change the “Label Color” text color. I tried object:setTextColor( r, g, b ), then button1:setTextColor(), label:setTextColor().

I stuck them just about everywhere. All I get are errors.

display.setStatusBar(display.HiddenStatusBar) local widget = require( "widget" ) local bgSky = display.newImageRect( "bgSky.png", 600, 400 ) bgSky.x = display.contentCenterX bgSky.y = display.contentCenterY local function handleButtonEvent( event ) if ( "ended" == event.phase ) then print( "Button was pressed and released - Label Color" ) end end local button1 = widget.newButton( { label = "button", onEvent = handleButtonEvent, emboss = false, shape = "roundedRect", width = 200, height = 40, cornerRadius = 20, fillColor = { default={0,0,0,1}, over={0,0,255,1} }, strokeColor = { default={0,0,255,1}, over={0,0,0,1} }, strokeWidth = 4 } ) button1.x = display.contentCenterX button1.y = display.contentCenterY - 60 button1:setLabel( "Label Color" )

Appreciate any help, 

Thanks

You can’t change the label color of a Widget button post- creation.

You’ll need to

  • create your own custom button library, - OR - 
  • extend widget.* (source code available on github),  - OR - 
  • dig into the object (not suggested) and find the handle to the label,  - OR - 
  • use a library that supports this feature like SSK2.

i.e. In SSK, this would be as easy as:

// SSK push button local button = easyIFC:presetPush( nil, "default", 100, 100, 50, 40, "Hello" ) button:setLabelColor( 1, 0, 0)

Great. Thanks for helping me.

You can’t change the label color of a Widget button post- creation.

You’ll need to

  • create your own custom button library, - OR - 
  • extend widget.* (source code available on github),  - OR - 
  • dig into the object (not suggested) and find the handle to the label,  - OR - 
  • use a library that supports this feature like SSK2.

i.e. In SSK, this would be as easy as:

// SSK push button local button = easyIFC:presetPush( nil, "default", 100, 100, 50, 40, "Hello" ) button:setLabelColor( 1, 0, 0)

Great. Thanks for helping me.