2013.2076 Widgets 2.0 Button issues with setFillColor

Before this  release  (2013.2076) I was creating widgets 2.0 buttons in my app , and changing their color using setFillColor() . Everything was working fine, buttons looked like this 

2k3a1f.jpg

but after the update the text is now covered by the filling color

vs2DXWy.jpg?1

when I touch the button and release it , then it looks as it should (the text becomes white and border darker).

this is the code I am using :

[lua] playBtn = widget.newButton{

        label=“Play Now”,

        labelColor = { default={255}, over={128} },

        emboss = true,

        width=154, height=40,

        onRelease = onPlayBtnRelease

    }

playBtn:setFillColor( 34, 140, 35 ) [/lua]

Is this a bug introduced in this release? Is there a solution for it?

Thanks in advance for your help!

Color values with Graphics 2.0 need to be in the 0.0 to 1.0 range (no more 0 to 255).

One quick way to change your colors in older projects would be to add “/255” to all color values.
Like: playBtn:setFillColor( 34/255, 140/255, 35/255 )

Remember to go through your whole project and change all color values you find.

Thanks for the reply but changing the values to numbers  from 0.0 to 1.0 did not solved the issue.

In fact the using values from 0 to 255 does changes the color of the button, but does not bring the text to front until the button is touched, to solve the problem I simulated the touch to the button on loading the scene and that worked fine, but this is kind of “hack solution”. There is an inconsistency in the behavior, setFillColor() changes the color of the button including the text, but touching the button brings the text to front excluding it from being overlay-ed by the color (which is the behavior i expected from the beginning)

I believe this is a bug related to the fact that text objects now use :setFillColor as well, where in G1.0, it was :setTextColor.  Please produce a small sample (create a new button, then call setFillColor()) and file a bug report using the “Report a Bug” link at the top.  We need this in the bug tracker so Engineering can work on it.

Thanks

Rob

I took a look at https://github.com/coronalabs/framework-widget/blob/master/widgetLibrary/widget_button.lua

Line 1069 is the cause of this issue.

Fixed it on my end as follows:

function button:setFillColor( ... ) for i = self.numChildren, 1, -1 do if "function" == type( self[i].setFillColor ) then if(self[i].\_isLabel ~= true) then self[i]:setFillColor( ... ) end end end end

Color values with Graphics 2.0 need to be in the 0.0 to 1.0 range (no more 0 to 255).

One quick way to change your colors in older projects would be to add “/255” to all color values.
Like: playBtn:setFillColor( 34/255, 140/255, 35/255 )

Remember to go through your whole project and change all color values you find.

Thanks for the reply but changing the values to numbers  from 0.0 to 1.0 did not solved the issue.

In fact the using values from 0 to 255 does changes the color of the button, but does not bring the text to front until the button is touched, to solve the problem I simulated the touch to the button on loading the scene and that worked fine, but this is kind of “hack solution”. There is an inconsistency in the behavior, setFillColor() changes the color of the button including the text, but touching the button brings the text to front excluding it from being overlay-ed by the color (which is the behavior i expected from the beginning)

I believe this is a bug related to the fact that text objects now use :setFillColor as well, where in G1.0, it was :setTextColor.  Please produce a small sample (create a new button, then call setFillColor()) and file a bug report using the “Report a Bug” link at the top.  We need this in the bug tracker so Engineering can work on it.

Thanks

Rob

I took a look at https://github.com/coronalabs/framework-widget/blob/master/widgetLibrary/widget_button.lua

Line 1069 is the cause of this issue.

Fixed it on my end as follows:

function button:setFillColor( ... ) for i = self.numChildren, 1, -1 do if "function" == type( self[i].setFillColor ) then if(self[i].\_isLabel ~= true) then self[i]:setFillColor( ... ) end end end end

Any news on that? This bug is still happening on daily build 2162.

And, on the daily build 2171 and 2174 the setFillColor stopped worked at all (submitted bug #30390 )

Any news on that? Is has been almost 3 months…

Unfortunately, it seams it is not going to get fixed, this is the reply I got :

"

Re: (Case 28509) 2013.2076 Widgets 2.0 Button issues with setFillColor

Hi there,

Unfortunately, this is not a bug, but a widget library limitation. We’ll be adding the setFillColor property as it was on the V1 version of the widget library in the near future though.

Thanks for the report, and a great day,

Alex"

In my opinion inconsistent behavior is a bug, therefore this is a bug.

not sure if same as 1.0 but could try

myButton._view._label:toFront()

where mybutton is the name of your button
I’m not at computer so can’t be sure if still will work or if it’s been changed a bit or completely

Definitively a bug…

Any news on that? This bug is still happening on daily build 2162.

And, on the daily build 2171 and 2174 the setFillColor stopped worked at all (submitted bug #30390 )

Any news on that? Is has been almost 3 months…

Unfortunately, it seams it is not going to get fixed, this is the reply I got :

"

Re: (Case 28509) 2013.2076 Widgets 2.0 Button issues with setFillColor

Hi there,

Unfortunately, this is not a bug, but a widget library limitation. We’ll be adding the setFillColor property as it was on the V1 version of the widget library in the near future though.

Thanks for the report, and a great day,

Alex"

In my opinion inconsistent behavior is a bug, therefore this is a bug.

not sure if same as 1.0 but could try

myButton._view._label:toFront()

where mybutton is the name of your button
I’m not at computer so can’t be sure if still will work or if it’s been changed a bit or completely

Definitively a bug…

Just tested here the fillColor and now it is not working one more, not even the background is being filled…

This code below worked on build 2162 but now not works any more.

local widget = require "widget" widget.setTheme( "widget\_theme\_ios" ) local b = widget.newButton{ label="Red Button" } b:setFillColor(1,0,0)