iOS Question Event Triggered after removing view

iCAB

Well-Known Member
Licensed User
Longtime User
Hi All

I have a popup that I use to replace a traditional spinner/picker.
The popup consists of a Panel, that hosts a title (button), ScrollView, and a Done button.

After removing the popup, using the code below, Panel_Click events for the scrollview panels keep firing up.

The exact same code has no issues with b4A
B4X:
Sub LAY_RemovePanelByTag( pnlParentPanel As Panel, PanelTag As String )
    Dim PopupPanel As Panel
  
    If pnlParentPanel.IsInitialized = True Then
        If LAY_GetViewIndexInPanel(pnlParentPanel, PanelTag) <> - 1 Then  
            PopupPanel = pnlParentPanel.GetView( LAY_GetViewIndexInPanel(pnlParentPanel, PanelTag) )
          
'********** This code also added to try resolve the issue with B4I           
            For i =  PopupPanel.NumberOfViews - 1 To 0 Step - 1
                Dim vView As View = PopupPanel.GetView(i)
              
                If vView Is ScrollView Then
                    Dim svView As ScrollView = vView
                    svView.Panel.RemoveAllViews
                End If
                LAY_RemoveView(PopupPanel.GetView(i))
            Next
'******* end of added code          
            PopupPanel.RemoveAllViews
            LAY_RemoveView(PopupPanel )
          
            PopupPanel = Null 'This was added as well to try to resolve the issue
        End If
      
    End If

End Sub




Sub LAY_RemoveView( vView As View )
#if B4A          
    vVIew.RemoveView
#else
    vView.RemoveViewFromParent
#end if          
    vView = Null 'This was added as well to try to resolve the issue
End Sub

Please advise
Thank you
 

iCAB

Well-Known Member
Licensed User
Longtime User
Sorry, purely my mistake after code restructuring to create all views in code through a class (in order for the events to work for both B4A & B4I equally )

Thank you
 
Upvote 0
Top