Android Question Click in panel, click in button of other panel. How not to do this.

netsistemas

Active Member
Licensed User
Longtime User
i have 2 panels (more, but for sample i say 2).

In panel1 have 8 button, y panel2 only 1 button.

the 2 panel have in same layout.
i move the top and left of panels and bring to front the main, but when the user do click in panel2 (not in any button), the event or button in panel1 are lunched.

That is, the button are not visible because the panel2 are on top, but the event are detected.

how disable the buttons in this panel1? i think to use other object, no panel, or set the panels in other layout, or .. ideas?

(i have 5 panels with submenus in the 8 buttons, each button show other panel, with 3 o 4 buttons)
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
That is, the button are not visible because the panel2 are on top, but the event are detected.
If I understand correctly, you have to do what you do with dialogs: write the touch event of the panel that is in foreground (empty event routine):
B4X:
Private Sub panel2_Touch (Action As Int, X As Float, Y As Float)
   
End Sub
This way the buttons located under panel2 will not receive the tap.
 
Upvote 0

Lucas Siqueira

Active Member
Licensed User
Longtime User
i have 2 panels (more, but for sample i say 2).

In panel1 have 8 button, y panel2 only 1 button.

the 2 panel have in same layout.
i move the top and left of panels and bring to front the main, but when the user do click in panel2 (not in any button), the event or button in panel1 are lunched.

That is, the button are not visible because the panel2 are on top, but the event are detected.

how disable the buttons in this panel1? i think to use other object, no panel, or set the panels in other layout, or .. ideas?

(i have 5 panels with submenus in the 8 buttons, each button show other panel, with 3 o 4 buttons)

place the event
B4X:
Sub panel2_click
End Sub
this will prevent the click from going through the panel
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
If I read your question right.

I believe when you set the panel visible to false you should also set the Enabled to false.
This was the panel is disabled from touches and touching on a button that is on the hidden panel would not happen.

' Panelx Not Seen - No Touches going to its buttons
panelx.Visible = false
panelx.Enabled = false

' Panely Seen and Touches going to it's buttons
panely.Visible = true
panely.Enabled = true
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
That (click event) does the same thing as adding the Touch event, except that the Touch event does not play the beep
There's a beep when pressing a button?? I've never heard it, is this an OS setting I disabled and forgot about?
 
Upvote 0

netsistemas

Active Member
Licensed User
Longtime User
SOLVED:
I add a funcionc to set only one panel visible. (the thecnig to do this with the previous panel activated are not very good_: PreviouPanel...)

B4X:
private Sub SetPanel(ElPanel As Panel)


    PanelMenu.Visible = False
    Panel1.Visible = False
    Panel2.Visible = False
    Panel3.Visible = False
    Panel4.Visible = False
    PanelPwdExpira.Visible = False

    
'    If PrevioPanel.IsInitialized Then
'        PrevioPanel.Visible = False
'    End If
    
    
    ElPanel.Visible = True
    ElPanel.BringToFront

    cmdMainPanel.Visible = True
    
    
'    PrevioPanel = ElPanel
End Sub
 
Upvote 0

netsistemas

Active Member
Licensed User
Longtime User
Added
B4X:
private Sub SetPanel(ElPanel As Panel)
    PanelEstadoOff(PanelMenu)
    PanelEstadoOff(Panel1)
    PanelEstadoOff(Panel2)
    PanelEstadoOff(Panel3)
    PanelEstadoOff(Panel4)
    PanelEstadoOff(PanelPwdExpira)
'    If PrevioPanel.IsInitialized Then
'        PrevioPanel.Visible = False 
'    End If
    ElPanel.Visible = True 
    ElPanel.BringToFront 
    cmdMainPanel.Visible = True 
'    PrevioPanel = ElPanel
End Sub
PRIVATE Sub PanelEstadoOff(Pan As Panel)
    Pan.Visible = False 
    Pan.Enabled = False 
    
End Sub
 
Upvote 0
Top