Android Question How do you make a label/button invisible inside scrollview?

Josh Christie

New Member
Licensed User
So I've got a scrollview with a couple buttons inside.
The test button when clicked, will pop up with a msgbox2. Depending on the answer of that msgbox (in this case, positive), I would like the SellBottle button to go invisible.

SellBottle.Visible = False doesn't seem to work.

Sub fillScrollView
Dim inventorypanel As Panel
inventorypanel = ScrollView1.Panel

If Store.BottleCount > 0 Then

SellBottle.Initialize("SellBottle")
inventorypanel.AddView(SellBottle,0,0,95%x,150)
SellBottle.Text = "Bottles of Oil: " & Store.BottleCount
SellBottle.TextSize = 12
SellBottle.Gravity = Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL)

End If

testbutton.Initialize("testbutton")
inventorypanel.AddView(testbutton,0,160,95%x,150)
testbutton.Text = "test button"
testbutton.Gravity = Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL)

End Sub

Sub testbutton_Click
testbuttonresult = Msgbox2("test","test","positive","","Negative",Null)
If testbuttonresult = DialogResponse.POSITIVE Then
SellBottle.Visible = False


End If
End Sub

Any help with this would be greatly appreciated! Thanks
 

LucaMs

Expert
Licensed User
Longtime User
It works for me (see the attached project).

Can you post your project (zip it using Menu File - Export As Zip)?

When you post some code, please use:
upload_2015-12-28_7-1-6.png
 

Attachments

  • ButtonInScrollView.zip
    11.4 KB · Views: 251
Upvote 0

Josh Christie

New Member
Licensed User
Thanks, I figured out what was wrong, I had it being initialized in both onCreate and onResume, so it was not behaving correctly there.
 
Upvote 0
Top