Android Question [Scrollview] - click event of a button!

WebQuest

Active Member
Licensed User
Hi community I'm having problems with the click event management of a button on a panel added to the scrollview. I am trying to program the event of the button to make a panel visible outside the scrollview, I am a beginner with the scrollview be patient. Could someone post an example?


B4X:
Sub Globals

Private Panel2 as Panel
dim NrItem As List
dim Panel1 As Panel
dim BtItem1 As button

End Sub

B4X:
Sub Activity_Create(FirstTime As Boolean)

Activity.LoadLayout("1")
 
NrItem=2
CreateAddView

End sub

Sub CreateAddView

    Dim i As Int
    For i=0 To NrItem-1
        panel1.Initialize("")
        panel1.SetLayout(0%x,0%x,100%x,100%x)
    
        BtItem1.Initialize("")
        BtItem1.Text="Item"&i
        BtItem1.Tag=i

panel1.AddView(BtItem1,1%x,1%x,27%x,HorizontalScrollViewItem.Height-2%x)
HorizontalScrollViewItem.Panel1.AddView(panel,0%x,0%x,320%x,HorizontalScrollViewItem.Height)

Next

  HorizontalScrollViewItem.Panel.Width=(NrItem)*(40%x)

End Sub

B4X:
Sub BtItem1_Click
 
    Panel2.visible=true 'does not work!

End Sub
 

watesoft

Active Member
Licensed User
Longtime User
Hi community I'm having problems with the click event management of a button on a panel added to the scrollview. I am trying to program the event of the button to make a panel visible outside the scrollview, I am a beginner with the scrollview be patient. Could someone post an example?


B4X:
Sub Globals

Private Panel2 as Panel
dim NrItem As List
dim Panel1 As Panel
dim BtItem1 As button

End Sub

B4X:
Sub Activity_Create(FirstTime As Boolean)

Activity.LoadLayout("1")
 
NrItem=2
CreateAddView

End sub

Sub CreateAddView

    Dim i As Int
    For i=0 To NrItem-1
        panel1.Initialize("")
        panel1.SetLayout(0%x,0%x,100%x,100%x)
  
        BtItem1.Initialize("")
        BtItem1.Text="Item"&i
        BtItem1.Tag=i

panel1.AddView(BtItem1,1%x,1%x,27%x,HorizontalScrollViewItem.Height-2%x)
HorizontalScrollViewItem.Panel1.AddView(panel,0%x,0%x,320%x,HorizontalScrollViewItem.Height)

Next

  HorizontalScrollViewItem.Panel.Width=(NrItem)*(40%x)

End Sub

B4X:
Sub BtItem1_Click
 
    Panel2.visible=true 'does not work!

End Sub
Where is the panel2 in Sub CreateAddView, I can't find it.
 
Upvote 0

WebQuest

Active Member
Licensed User
I am trying to display a panel that is not in the scollview. I need you to click on the button to see a common panel for all the items
 
Upvote 0
Top