How to do a screen like the popup message?

raaiman

Member
Licensed User
Longtime User
Hi All,

i captured a screen from what's app to show my problem.please see attachment.i want to do a popup window like that.i try to use a new activity to show the popup,but i can't see the previous screen as the background.then i tried to add the popup in current activity,but how can i make it only have touch event inside the popup area?
what is the correct way to do a screen like this?
 

Attachments

  • what'sapp.jpg
    what'sapp.jpg
    44.3 KB · Views: 738

kickaha

Well-Known Member
Licensed User
Longtime User
You can add a transparent panel that fills the screen, and consume the touch events to it so that the underlying views do not see them.

You can then add buttons etc to this panel.

B4X:
Sub Popup_Click
   Dim pnlInput As Panel
   pnlSelect.Initialize ("Select")
   pnlSelect.Color  = Colors.ARGB (150,0,0,0)
   Activity.AddView (pnlSelect, 0, 0,   100%x, 100%y)
End Sub

Sub Select_Click 
End Sub

Using this code, you can add layouts/buttons etc to pnlSelect. When you are finished use
B4X:
pnlSelect.RemoveView
to get back to your main screen.
 
Upvote 0

raaiman

Member
Licensed User
Longtime User
I have created the transparent panel,but it seems that both this panel and mainscreen can receive the touch event.
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
My bad, the Select_Click sub should be
B4X:
Sub Select_Click 
Return True
End Sub
to consume the touch events.
 
Upvote 0

raaiman

Member
Licensed User
Longtime User
yes,you are right,it should add "Return True".thank you.
btw... how can i see if a sub has the return value?because i can't see any description about it on the document.
 
Upvote 0
Top