Button gets clicked when clicking outside

In my project i have given 3 buttons.The problem is even if i click outside the button, the button gets clicked sometimes the adjacent button gets clicked.

eg1 clicking outside button1 and button 1 gets clicked

eg2 clicking outside button1 and button2 gets clicked

please help me 

 

-- Require the widget library local widget = require( "widget" ) function button1released(event) print("button1released") end function button2released(event) print("button2released") end function button3released(event) print("button3released") end local button1 = widget.newButton( { width = 140, height = 100, defaultFile = "b1.png", overFile = "b1over.png", onRelease = button1released } ) button1.x = 60 button1.y = 20 local button2 = widget.newButton( { width = 140, height = 100, defaultFile = "b2.png", overFile = "b2over.png", onRelease = button2released } ) button2.x = 160 button2.y = 20 local button3 = widget.newButton( { width = 140, height = 100, defaultFile = "b3.png", overFile = "b3over.png", onRelease = button3released } ) button3.x = 260 button3.y = 20
  1. Please one question per post, otherwise you risk getting the wrong question answered.

  2. Please format your code with the code widget at top of editor.

formatyourcode.jpg

3a. Your buttons are clickable anywhere in their bounds, even if part of the image used to make the button is transparent.

3b.  Images used to make a button must be the same size. Are they?

  1. In a case  like this, the best way to get help (assuming #3 isn’t the cause) is to create a small sample project demonstrating the issue, zip it up, post it to dropbox (or other safe and well known sharing service), link it here.

That way, we can download it and see the exact problem.  In cases like this, it is easiest to debug and assist with the actual issue in hand.  Also, this saves on the need to post code, read code, puzzle out what you’re doing, etc.

This is a real problem now.

I’d love to see that sample as a zip (see my answer part #4 above)

Sir,

Thank you for the help.I think the problem was with the images.i used different images for default and over files.so changed the images first and then changed the orientation to landscape so getting enough space for the buttons.

  1. Please one question per post, otherwise you risk getting the wrong question answered.

  2. Please format your code with the code widget at top of editor.

formatyourcode.jpg

3a. Your buttons are clickable anywhere in their bounds, even if part of the image used to make the button is transparent.

3b.  Images used to make a button must be the same size. Are they?

  1. In a case  like this, the best way to get help (assuming #3 isn’t the cause) is to create a small sample project demonstrating the issue, zip it up, post it to dropbox (or other safe and well known sharing service), link it here.

That way, we can download it and see the exact problem.  In cases like this, it is easiest to debug and assist with the actual issue in hand.  Also, this saves on the need to post code, read code, puzzle out what you’re doing, etc.

This is a real problem now.

I’d love to see that sample as a zip (see my answer part #4 above)

Sir,

Thank you for the help.I think the problem was with the images.i used different images for default and over files.so changed the images first and then changed the orientation to landscape so getting enough space for the buttons.