Button on top of the image, why?

As I understood from the documentation, it is enough to place the image in a group created later than the group in which the button is placed. But in my case, something is wrong. Does this work for widget buttons? Also, I would like to know if the coronalabs forum will work there were many answers to my stupid questions :slight_smile: Also I would like to know how such a pop-up window with a close button is done?

First of all, you can search this forum for some of your answers. Corona forums are all migrated.

Second, if you could post some sample projects we may be able to help you with the problems you’re facing.

1 Like

You can take apart my code to work out how to make a window/button/etc that slides onto the screen:




https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/dialogs/

1 Like

Sorry. In this code why Img picture is under the button?

local function bingoFunction ()
	local img = display.newImageRect( descGroup, imgSheet, Ind, 320, 242)
end

function scene:create( event )
	local sceneGroup = self.view

	mainGroup = display.newGroup() .
	sceneGroup:insert( mainGroup )  
	
	uiGroup = display.newGroup()
	sceneGroup:insert( mainGroup )
	
	descGroup = display.newGroup() 
	sceneGroup:insert( descGroup )
end

function scene:show( event ) 
	if ( phase == "will" ) then
    elseif ( phase == "did" ) then 
		btnDesc = widget.newButton(
			{
				x = 295,				
				y = 120,
				width = 40,
				height = 40,
				defaultFile = "BtnT1.png",
				overFile = "BtnT2.png",
				id = "btnT",
				label = "D",
				labelColor = { default={ 1, 1, 1 }, over={ 0, 0, 0, 0 } },
				font = "MaterhornNF.ttf",
				fontSize = 30,
				onEvent = showDescripton
			}
		)
		btnDesc:insert( uiGroup )
      end

I think I see two problems in your code.

You’re not inserting uiGroup into sceneGroup:

uiGroup = display.newGroup()
sceneGroup:insert(mainGroup)

Should be:

sceneGroup:insert(uiGroup)

And you’re inserting uiGroup into btnDesc instead of the other way around:

btnDesc:insert(uiGroup)

Should probably be:

uiGroup:insert(btnDesc)

3 Likes

@neo_freeman

You PM’d me a bit ago.

If you decide to use SSK2 and get entirely stuck producing a working dialog with it, post back here, and provide an image for the dialog box and I’ll give you a little help.

Tried to run Validation Sampler from SSK2 Suite. Everything works except just dialog boxes. I got this error. Since I was not yet experienced myself I could not figure it out.errorscr

Error with any dialog box from this sample.