Can I have a square widget button with no borders ?

I am trying to have just a plain square button in red with no border etc… but I can’t seem to get it right. It’s like Corona is ignoring my setting (or am not doing it right).

I know I could just draw a red square and add a touch listener but I like widget buttons as they are usually hassle free.

local redButton = widget.newButton{  
 defaultColor = {255,0,0},  
 overColor = {255,0,0},  
 strokeWidth = 0,  
 strokeColor = {255,0,0},  
 cornerRadius = 0,  
 width = 30,  
 height = 30,  
 onRelease = redButton\_Click  
}  
redButton.x = storyboard.globals.leftX + 140  
redButton.y = storyboard.globals.topY + 205  

The button still has a corner radius and still has a stoke and the over colour is a dark green.

Dave [import]uid: 117617 topic_id: 31634 reply_id: 331634[/import]

Hey, Dave, I was curious, so I copied and pasted your code to my project (at the bottom of scene:createScene function), and a perfectly square red button appeared:

-- perfectly red square button  
local redButton = widget.newButton{  
 defaultColor = {255,0,0},  
 overColor = {255,0,0},  
 strokeWidth = 0,  
 strokeColor = {255,0,0},  
 cornerRadius = 0,  
 width = 30,  
 height = 30,  
 onRelease = redButton\_Click  
}  
redButton.x = 240  
redButton.y = 160  

When I removed strokeWidth, strokeColor and cornerRadius, it looked horrid:

-- black outline with jagged corners  
local redButton = widget.newButton{  
 defaultColor = {255,0,0},  
 overColor = {255,0,0},  
 width = 30,  
 height = 30,  
 onRelease = redButton\_Click  
}  
redButton.x = 240  
redButton.y = 160  

Naomi
[import]uid: 67217 topic_id: 31634 reply_id: 126368[/import]

Hi Naomi,

Very weird, when include the widget library do you set any themes ?

Is this in simulator or on device ?

Will upload a screen shot of what I see.

EDIT: Here is the screenshot -

http://www.caniplay.co.uk/temp/Screen%20Shot%202012-10-04%20at%2019.36.56.png

Am trying to do a colour picker with 6 buttons.

Dave [import]uid: 117617 topic_id: 31634 reply_id: 126374[/import]

Hey, Dave, wow, that’s weird.

I didn’t build it for device. I just dropped the code into my current project, and I see the perfect red square on the center, when viewed on simulator. I didn’t set any theme – all I do is to require widget at the top of the code. And… I’m using daily build 925 at the moment.

Do you see perfect square on simulator, and then it turns into what you screen captured when displayed on device?

It could be a bug that you may want to report with a simple project with the bit of code that shows the issue.

Naomi [import]uid: 67217 topic_id: 31634 reply_id: 126401[/import]

This is all in the simulator using the latest public release.

Ah well.

Dave [import]uid: 117617 topic_id: 31634 reply_id: 126405[/import]

I got the same thing as Naomi, nice red square.

Just in case it was some weird interaction with storyboard I plopped your chunk of code into one of the scenes on my project and when I went there, another perfect red square sitting there.

I’ll echo Naomi’s question – are you seeing the problem on the simulator or device? If the latter, which device?

Jay [import]uid: 9440 topic_id: 31634 reply_id: 126406[/import]

Am seeing it in the simulator, not tried on device.

Can’t think what else would effect it, it’s in storyboard but hardly anything else in the same scene yet.

Will try changing one of my title screen buttons and see if I get the same results.

Dave [import]uid: 117617 topic_id: 31634 reply_id: 126408[/import]

Found out what was causing it.

In my titlescreen.lua scene I was setting the theme to theme_ios.

I didn’t realise this would affect all scenes, I thought it would only effect the scene which it is set in.

Dave [import]uid: 117617 topic_id: 31634 reply_id: 126477[/import]

Hey, Dave, glad to hear you’ve sorted this out. That’s interesting, and not a big surprise. I’ve found a few (and similar) unexpected idiosyncrasies when using storyboard too.

Naomi [import]uid: 67217 topic_id: 31634 reply_id: 126529[/import]

Hey, Dave, I was curious, so I copied and pasted your code to my project (at the bottom of scene:createScene function), and a perfectly square red button appeared:

-- perfectly red square button  
local redButton = widget.newButton{  
 defaultColor = {255,0,0},  
 overColor = {255,0,0},  
 strokeWidth = 0,  
 strokeColor = {255,0,0},  
 cornerRadius = 0,  
 width = 30,  
 height = 30,  
 onRelease = redButton\_Click  
}  
redButton.x = 240  
redButton.y = 160  

When I removed strokeWidth, strokeColor and cornerRadius, it looked horrid:

-- black outline with jagged corners  
local redButton = widget.newButton{  
 defaultColor = {255,0,0},  
 overColor = {255,0,0},  
 width = 30,  
 height = 30,  
 onRelease = redButton\_Click  
}  
redButton.x = 240  
redButton.y = 160  

Naomi
[import]uid: 67217 topic_id: 31634 reply_id: 126368[/import]

Hi Naomi,

Very weird, when include the widget library do you set any themes ?

Is this in simulator or on device ?

Will upload a screen shot of what I see.

EDIT: Here is the screenshot -

http://www.caniplay.co.uk/temp/Screen%20Shot%202012-10-04%20at%2019.36.56.png

Am trying to do a colour picker with 6 buttons.

Dave [import]uid: 117617 topic_id: 31634 reply_id: 126374[/import]

Hey, Dave, wow, that’s weird.

I didn’t build it for device. I just dropped the code into my current project, and I see the perfect red square on the center, when viewed on simulator. I didn’t set any theme – all I do is to require widget at the top of the code. And… I’m using daily build 925 at the moment.

Do you see perfect square on simulator, and then it turns into what you screen captured when displayed on device?

It could be a bug that you may want to report with a simple project with the bit of code that shows the issue.

Naomi [import]uid: 67217 topic_id: 31634 reply_id: 126401[/import]

This is all in the simulator using the latest public release.

Ah well.

Dave [import]uid: 117617 topic_id: 31634 reply_id: 126405[/import]

I got the same thing as Naomi, nice red square.

Just in case it was some weird interaction with storyboard I plopped your chunk of code into one of the scenes on my project and when I went there, another perfect red square sitting there.

I’ll echo Naomi’s question – are you seeing the problem on the simulator or device? If the latter, which device?

Jay [import]uid: 9440 topic_id: 31634 reply_id: 126406[/import]

Am seeing it in the simulator, not tried on device.

Can’t think what else would effect it, it’s in storyboard but hardly anything else in the same scene yet.

Will try changing one of my title screen buttons and see if I get the same results.

Dave [import]uid: 117617 topic_id: 31634 reply_id: 126408[/import]

Found out what was causing it.

In my titlescreen.lua scene I was setting the theme to theme_ios.

I didn’t realise this would affect all scenes, I thought it would only effect the scene which it is set in.

Dave [import]uid: 117617 topic_id: 31634 reply_id: 126477[/import]

Hey, Dave, glad to hear you’ve sorted this out. That’s interesting, and not a big surprise. I’ve found a few (and similar) unexpected idiosyncrasies when using storyboard too.

Naomi [import]uid: 67217 topic_id: 31634 reply_id: 126529[/import]