Random Errors With Composer Overlay

Hi,

I have a scene which calls an overlay.

99 times out of 100 everything works fine.

However, occasionally when I go from the main scene to the overlay, the main scene remains visible and is underneath the overlay which is on top. I can hit the back button on the overlay which takes me back to the main scene. Accessing the overlay again will from then on repeat this behaviour i.e. both the main scene and the overlay are visible with the overlay on top and the main scene behind.

If I change to a totally different scene and then go back to the errant scene, the problem rectifies itself and the scene behaves as it should do but at some stage the issue will come back again.

There are also instances when I have the main scene, and randomly, parts of the overlay scene appear on top of the main scene without me touching the screen.

Please help as the app is now complete and I want to publish it on the app before Xmas.

Thanks in advance

I have just added some screenshots.

 

  1. Normal Main Scene

 

  1. Normal Overlay Scene

 

  1. Corrupted/Error Overlay Scene

 

 

Please help.

 

 

This is one of those things where people need to see the code to see the problem, and I think you probably don’t want to share your code?  This is just a guess, but if you don’t mind folks looking at your code, they’ll need to see the scene files for all interfaces involved.

Regardless,

This sounds like an issue where you may not be letting the scenes handle your content correctly.  i.e. 99% of the time when i see this, it is because something didn’t get inserted into a scene’s group when it should have (due to a coding error).

So, I’d check to be sure you’re putting everything for the individual scenes in their respective scene groups.

Hi,

Thanks for the reply.

The issue is definately to do with scene groups but there is only 1 object in the main scene (mainscene.lua) and there definately is the line in the Show() method :

sceneGroup:insert( wc_MainListEditMenuItems )

I can reproduce the issue 100% of the time by just removing the above line and obviously the main scene will still be displayed under the overlay.

I have just changed the code which calls the overlay to add the main scene again into the scene group. Very early testing indicates that the problem has been stabilised. Are there any issues with adding an object to the same group  more than once?

                                local optionsTable =

                                  {

                                      isModal = true,

                                      effect = “fade”,

                                      time = 400,

                                      params = {

                                          paramAddMode = ( ListData[positionInWidget].iconR == 7 ),

                                      }

                                  }

                                  – Add the list widget to scene again even though we have already added it before

                                  sceneGroup:insert( wc_MainListEditMenuItems )

                                  composer.showOverlay( “editmenuitems”, optionsTable )

I will do some proper testing and let you know if the workaround has fixed the issue.

Thanks

I’m running into a problem right now where the willHide phase is being called right after I go into my modal overlay. The stuff in create is done and then willHide fires, which runs a function back in the parent composer scene.

In other words, willHide phase is being called before I ever tell the overlay to hide. Might want to make sure in your case that the events are being fired when you think they are.

 Jay

Hi again.  Did this ever get resolved?  Do you still need help?

Hi,

I thought I had ‘fixed’ it by adding the list widget to the scene group (for the second time) just before loading the overlay but I have just built another release and the problem which went away has now come back again. The main scene behaves correctly for 70% of the time but 30% of the time it does not and the list widget which should be hidded/destroyed does not - can you help?

Here is the parent scene code.

function scene:show( event )

  local sceneGroup = self.view

  local phase = event.phase

  if phase == “did” then

    wc_MainListEditMenuItems = _G.GUI.NewList(

      {

        x                 = 5,

        y                 = 35,               

        itemHeight        = 40,

        width             = display.contentWidth - 20,                  

        height            = “90%”,                  

        scale             = _G.GUIScale,

        parentGroup       = nil,                    

        theme             = “theme_1”,              

        name              = “LST_MAIN_EDITMENUITEMS”,             

        scrollbar         = “onScroll”,

        list              = ListData,               

        allowDelete       = true,      

        readyCaption      = “Quit Deleting”, 

        border            = {“shadow”, 8,8, .25},

        onIconPressR      = function( EventDataSelectedItem )

                              – Right hand icon pressed so add/edit record

                              selectedItem = ListData[EventDataSelectedItem.selectedIndex].positionInMainArray

                              – Mark the record as being selected

                              wc_MainListEditMenuItems:setIndex( EventDataSelectedItem.selectedIndex )

                              positionInWidget = EventDataSelectedItem.selectedIndex

                              local optionsTable =

                                {

                                    isModal = true,

                                    effect = “fade”,

                                    time = 400,

                                    params = {

                                        paramAddMode = ( ListData[positionInWidget].iconR == 7 ),

                                    }

                                }

                                – Add to scene again to try to fix the bug where the list widget is still displayed in front of the overlay screen

                                sceneGroup:insert( wc_MainListEditMenuItems )

                                composer.showOverlay( “editmenuitems”, optionsTable )

                            end,

      }

    )

    – Add list widget to the scene

    sceneGroup:insert( wc_MainListEditMenuItems )

end

Thanks in advance

Hi,

Can anyone help with this please?

Thanks

Without knowing what _G.GUI.NewList is and some of the other functions is, we can’t even begin to speculate where something might not be getting inserted into the sceneView correctly.

Rob

Hi Rob,

_G.GUI.NewList is the listview widget from the third party WidgetCandy library. It is the only object on the scene and is definately being inserted correctly into the scene

i.e. sceneGroup:insert( wc_MainListEditMenuItems )

Anil

We cannot possibly know what’s going on inside of  Widget Candy.  Please reach out to the author for support.  Just because you’re putting the item they return you, that doesn’t guarantee everything they are putting together is being handled correctly.

Rob

This is one of those things where people need to see the code to see the problem, and I think you probably don’t want to share your code?  This is just a guess, but if you don’t mind folks looking at your code, they’ll need to see the scene files for all interfaces involved.

Regardless,

This sounds like an issue where you may not be letting the scenes handle your content correctly.  i.e. 99% of the time when i see this, it is because something didn’t get inserted into a scene’s group when it should have (due to a coding error).

So, I’d check to be sure you’re putting everything for the individual scenes in their respective scene groups.

Hi,

Thanks for the reply.

The issue is definately to do with scene groups but there is only 1 object in the main scene (mainscene.lua) and there definately is the line in the Show() method :

sceneGroup:insert( wc_MainListEditMenuItems )

I can reproduce the issue 100% of the time by just removing the above line and obviously the main scene will still be displayed under the overlay.

I have just changed the code which calls the overlay to add the main scene again into the scene group. Very early testing indicates that the problem has been stabilised. Are there any issues with adding an object to the same group  more than once?

                                local optionsTable =

                                  {

                                      isModal = true,

                                      effect = “fade”,

                                      time = 400,

                                      params = {

                                          paramAddMode = ( ListData[positionInWidget].iconR == 7 ),

                                      }

                                  }

                                  – Add the list widget to scene again even though we have already added it before

                                  sceneGroup:insert( wc_MainListEditMenuItems )

                                  composer.showOverlay( “editmenuitems”, optionsTable )

I will do some proper testing and let you know if the workaround has fixed the issue.

Thanks

I’m running into a problem right now where the willHide phase is being called right after I go into my modal overlay. The stuff in create is done and then willHide fires, which runs a function back in the parent composer scene.

In other words, willHide phase is being called before I ever tell the overlay to hide. Might want to make sure in your case that the events are being fired when you think they are.

 Jay

Hi again.  Did this ever get resolved?  Do you still need help?

Hi,

I thought I had ‘fixed’ it by adding the list widget to the scene group (for the second time) just before loading the overlay but I have just built another release and the problem which went away has now come back again. The main scene behaves correctly for 70% of the time but 30% of the time it does not and the list widget which should be hidded/destroyed does not - can you help?

Here is the parent scene code.

function scene:show( event )

  local sceneGroup = self.view

  local phase = event.phase

  if phase == “did” then

    wc_MainListEditMenuItems = _G.GUI.NewList(

      {

        x                 = 5,

        y                 = 35,               

        itemHeight        = 40,

        width             = display.contentWidth - 20,                  

        height            = “90%”,                  

        scale             = _G.GUIScale,

        parentGroup       = nil,                    

        theme             = “theme_1”,              

        name              = “LST_MAIN_EDITMENUITEMS”,             

        scrollbar         = “onScroll”,

        list              = ListData,               

        allowDelete       = true,      

        readyCaption      = “Quit Deleting”, 

        border            = {“shadow”, 8,8, .25},

        onIconPressR      = function( EventDataSelectedItem )

                              – Right hand icon pressed so add/edit record

                              selectedItem = ListData[EventDataSelectedItem.selectedIndex].positionInMainArray

                              – Mark the record as being selected

                              wc_MainListEditMenuItems:setIndex( EventDataSelectedItem.selectedIndex )

                              positionInWidget = EventDataSelectedItem.selectedIndex

                              local optionsTable =

                                {

                                    isModal = true,

                                    effect = “fade”,

                                    time = 400,

                                    params = {

                                        paramAddMode = ( ListData[positionInWidget].iconR == 7 ),

                                    }

                                }

                                – Add to scene again to try to fix the bug where the list widget is still displayed in front of the overlay screen

                                sceneGroup:insert( wc_MainListEditMenuItems )

                                composer.showOverlay( “editmenuitems”, optionsTable )

                            end,

      }

    )

    – Add list widget to the scene

    sceneGroup:insert( wc_MainListEditMenuItems )

end

Thanks in advance

Hi,

Can anyone help with this please?

Thanks

Without knowing what _G.GUI.NewList is and some of the other functions is, we can’t even begin to speculate where something might not be getting inserted into the sceneView correctly.

Rob

Hi Rob,

_G.GUI.NewList is the listview widget from the third party WidgetCandy library. It is the only object on the scene and is definately being inserted correctly into the scene

i.e. sceneGroup:insert( wc_MainListEditMenuItems )

Anil

We cannot possibly know what’s going on inside of  Widget Candy.  Please reach out to the author for support.  Just because you’re putting the item they return you, that doesn’t guarantee everything they are putting together is being handled correctly.

Rob