Disable Layout objects while another layout is shown

aaronk

Well-Known Member
Licensed User
Longtime User
Hello,

When my app opens I am loading my Layout using the following code:

B4X:
Activity.LoadLayout("Main")

So far so good.

On my 'Main' layout I have a button that will display another layout called 'test' and I am calling it using:

B4X:
Activity.LoadLayout("test")

Now I have 2 layouts open at the same time, which I want. I have my 'test' layout 100% the width and height and set the background color to Black and set the Alpha to 200 which allow me to still see the 'Main' layout which I want.

However how can I make it so that you can't click on buttons/objects from the 'Main' layout while the 'test' layout is shown ?

(I want to be able to see the 'Main' layout as well as the 'test' layout at the same time)

Any one got any ideas?
 

klaus

Expert
Licensed User
Longtime User
You should add a full screen panel in your test layout and put all the views onto this panel and set its background color with the 200 alpha.
Then add the click event routine for this panel with no code in the routine consuming the event so it's not transfered to the underlying views.

Best regards.
 
Last edited:
Upvote 0

lagore

Active Member
Licensed User
Longtime User
You need to prevent the click events reaching the 'main' layout so on the 'test' layout put a transparent panel (100%x & 100%y) on the activity with all the other objects of your layout on top of this panel, then generate the click event for this panel. You do not need any code in the panel click_event sub but it absorbs the click and prevents it reaching the items below. This technique is very handy if say you are getting some data from the web and you do not want the user to interact with the form on screen put a semi transparent over it with a "please wait" label and absorb the click event.
edit: looks like Klaus can type quicker then I can.
 
Last edited:
Upvote 0
Top