Buttons work a panel under another panel?

wheretheidivides

Active Member
Licensed User
Longtime User
I have a main screen with a panel (panel_main). There are 4 buttons.

When you press a button it takes you to another panel (panel_2).

Both of these panels are full screen.

When panel_2 is full screen, if you press on the area whenre panel_main's buttons are, they work. You can not see them, but they work.

I thought if panel_2 was brought to the front and full screen that it covered up the lower panels and thus the lower panels buttons would not work. Am I right on this or what?
 

wheretheidivides

Active Member
Licensed User
Longtime User
So is this for the main panel (with the hidden button) or the 2nd panel (now full screen)? Also, does this de-activate the 1st panel or activate the second? I am having this same problem.


Sub Panel1_Touch(Action As Int, X As Float, Y As Float) As Boolean
Return True
End Sub
 
Last edited:
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
B4X:
Sub Panel2_Click
End Sub

That is by design. The code above should prevent the clicks from going through.
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
in Android panels will pass through their touch events.

What I do is make all other panels hidden as I move from one to another.

This stops the bahaviour you're describing.

regards, Ricky
 
Upvote 0

wheretheidivides

Active Member
Licensed User
Longtime User
in Android panels will pass through their touch events.

What I do is make all other panels hidden as I move from one to another.

This stops the bahaviour you're describing.

regards, Ricky


hidden as in not enabled? so the code would be
panel1.enabled=false???
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
You set the Visible property :

B4X:
Sub buttonClick(PanelNumber As Int)
    If PanelNumber=1 Then
        panel1.Visible = True
        panel2.Visible = False
        panel3.Visible = False
    Else If PanelNumber=2 Then
        panel1.Visible = False
        panel2.Visible = True
        panel3.Visible = False
    End If
End Sub

cheers, Ricky
 
Upvote 0

wheretheidivides

Active Member
Licensed User
Longtime User
Ok, cool. so if a panel is not visible (false) the buttons will not work. So I just bring the new panel to the front, make it visible and make every other panel invisible (I guess I make them all invisible when the program is created.)

Thanks
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
I set all mine invisible then show whichever one I want using this technique.

regards, Ricky
 
Upvote 0

Andras

Active Member
Licensed User
Longtime User
Assuming you then want the upper panel to disappear when the user taps the 'back' button, you can trap that event to make the top panel invisible and the bottom one visible again - something like this:

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
   If KeyCode = KeyCodes.KEYCODE_BACK Then
      If Panel2.Visible = True Then
           Panel2.Visible = False
           Panel1.Visible = True
                End If
        End If
End Sub

Very useful!

John
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
You would need to consume the keypress by
B4X:
Return True
otherwise the activity would be closed.

Cheers Ricky
 
Upvote 0
Top