Can't see the button appear

I’m trying to create a button with an image but i can’t see the image. I only see a white box with my label (see screenshot) in it. I have a image named btn.png in the same folder as main.lua.

This is my code so far:

local background = display.newRect(0,0,320,480); background:setFillColor(255,222,255); local widget = require("widget"); local text = display.newText("Dit is een text", 0, 0, native.systemFont, 32); text:setTextColor(0,0,0); text.x = 100; text.y = 100; local btn = widget.newButton{ id = "Button 1", width = 256, height = 256, top = 100, left = 50, label = "Dit is een knopke", labelColor = { default = {245,244,245}, over = {255,145,167} }, defaultFile = "btn.png", } 

I don’t see what is wrong with my code. I also searched for it in the corona docs but i don’t see what is wrong with it.

Hey Joeri -dit is een knopke- Jacobs,  :slight_smile:
 
I had the same issue. But looking at your code actually solved my issue. Thanks!
Instead of:

defaultFile = "btn.png" 

my code looked like:

default = "btn.png"

…which was probably a copy-paste left over, and which actually worked on one of my laptops. I changed to ‘defaultFile’ and it works now on my other laptop too.

Maybe you can try vice versa?

groeten,

Thomas

Hallo Thomas  :slight_smile: ,

I tried it now with default instead of defaultFile but the problem still exist. Maybe i will try it with an earlier version of corona sdk. 

Off the record  :stuck_out_tongue: : Ben je al lang bezig met Corona SDK? Ik heb het net sinds een week ontdekt en ik vindt het wel een veel beter systeem dan de native ontwikkeling. Heb je al werkende apps gemaakt met dit systeem? 

Are you 100% sure file name is correct
They’re case sensitive

You’re missing () around newButton options

Well, in the corona docs there is an example without those brackets. See this: http://docs.coronalabs.com/api/library/widget/newButton.html

And i tried it also with the brackets, so that isn’t the issue. And the name is 100% correct. All in small characters: btn.png

Have you tried with a different file or no file at all
Is file png-24

No, i didn’t tried that. I just took a png image from google. I will try another png file.

There is is one thing i didn’t tell you. If i run or re-run the simulator i’m getting a message that my computer don’t meet the minimum requirements. I have OpenGL v 1.1 and the sim requires v 1.3. Could this be the problem? 

And can anyone let me know where to download OpenGL 1.3?

Thanks.

That could be the problem indeed.

Try updating your graphics hardware drivers.

http://www.opengl.org/wiki/Getting_started

guys, 

i found the problem and it is indeed ecause of a older version of openGL that i have. I searched for a new update for my graphic card but my notebook is to old so i can’t find a newer update then the one that i have. 

I tested my app with the button on another notebook and there it worked perfect. So i guess that i have to spend some money on a new notebook  :rolleyes:

Hey Joeri -dit is een knopke- Jacobs,  :slight_smile:
 
I had the same issue. But looking at your code actually solved my issue. Thanks!
Instead of:

defaultFile = "btn.png" 

my code looked like:

default = "btn.png"

…which was probably a copy-paste left over, and which actually worked on one of my laptops. I changed to ‘defaultFile’ and it works now on my other laptop too.

Maybe you can try vice versa?

groeten,

Thomas

Hallo Thomas  :slight_smile: ,

I tried it now with default instead of defaultFile but the problem still exist. Maybe i will try it with an earlier version of corona sdk. 

Off the record  :stuck_out_tongue: : Ben je al lang bezig met Corona SDK? Ik heb het net sinds een week ontdekt en ik vindt het wel een veel beter systeem dan de native ontwikkeling. Heb je al werkende apps gemaakt met dit systeem? 

Are you 100% sure file name is correct
They’re case sensitive

You’re missing () around newButton options

Well, in the corona docs there is an example without those brackets. See this: http://docs.coronalabs.com/api/library/widget/newButton.html

And i tried it also with the brackets, so that isn’t the issue. And the name is 100% correct. All in small characters: btn.png

Have you tried with a different file or no file at all
Is file png-24

No, i didn’t tried that. I just took a png image from google. I will try another png file.

There is is one thing i didn’t tell you. If i run or re-run the simulator i’m getting a message that my computer don’t meet the minimum requirements. I have OpenGL v 1.1 and the sim requires v 1.3. Could this be the problem? 

And can anyone let me know where to download OpenGL 1.3?

Thanks.

That could be the problem indeed.

Try updating your graphics hardware drivers.

http://www.opengl.org/wiki/Getting_started