Dim maskPanel As B4XView = xui.CreatePanel("")
Root.AddView(maskPanel, 0, 0, Root.Width, Root.Height)
'...
'As last step:
maskPanel.BringToFront
Sub createPanel
Private panelX As Panel
Log("add panel")
panelX.Initialize("pQuest")
Private lbl As Label
lbl.Initialize("")
lbl.Text = "xxx yyy zzz"
lbl.TextSize = 20
lbl.TextColor = Colors.Black
' lbl.Color = Colors.Green
Private cd As ColorDrawable
cd.Initialize2(Colors.ARGB(125, 255, 255, 255), 20, 1, Colors.Gray)
panelX.Background = cd
p_Main.AddView(panelX, 10, 0, 80%x, 200dip) 'add the panel to the layout
panelX.AddView(lbl, 20, 10, (panelX.Width * 0.9), 80dip)
panelX.left = (Root.Width / 2) - (panelX.Width / 2)
panelX.top = (Root.Height / 2) - (panelX.Height / 2)
panelX.BringToFront
panelX.Elevation = 100dip
panelX.Visible = True
End Sub
I appreciate your help, that's what I'm doing at the moment, but I thought it'd be more efficient if everything was in the same Sub.I think the only solution is for each panel you create to assign the same event name and write a single empty Sub Click using that name.
To make sure that a view behind a Panel does not get any events you need:
1. An empty Click or Touch event.
2. A higher Panel elevation than the views underneath it.
One common event routine for different Panels works.
In the code in post #3, you have this line: panelX.Initialize("pQuest")
Do you have the Sub pQuest_Click routine ?
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Show
Dim b As Button
b.Initialize("button")
b.Text = "New but1"
b.Tag = "but1"
MainForm.RootPane.AddNode(b, 0, 0, 200, 50)
End Sub
Sub button_Click
Dim b As Button = Sender
Log(b.Tag)
End Sub
Perhaps he means that just setting the Elevation is not the solution, it doesn't work. That's right and that's not what Klaus intended, you need both (although BringToFront + the Click event might be enough).The higher elevation does not work, only the empty pQuest_Click Sub, and yes, I have it defined!! ?
Can you post your project ?
Before posting my previous post i did some tests.
Attached my test program.
Yes, I knew that the empty Click event routine is necessary, I wrote it in post#7.If you comment the Sub on line 105 (pSombra_Click) the clicks go through, even with the Elevation and BringToFront set in lines 94 and 95.
you can create the panel programmatically and initialize always with the same eventName that is present in your app and does nothing.Hi everybody,
I am creating a panel programmatically, and would like to make it so that, if you click on any part of the panel and there is a button behind the panel, it does not trigger the click of that button.
Normally I would just create an empty sub with the panel name and "_Click" (e.g., myPanel_Click), and that would do the trick.
But I would like to know if it is possible to generate the Sub programmatically, or create the same result any other way.
Best regards
Sub doesNothingPanel_Click
' do nothing
End Sub
DIm pnl as B4xView = XUI.Createpanel("doesNothingPanel")
...
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?