Hi, i need to have a custom dialog.
I tried the Dialog library loaded with a layout (with a panel), but the dialog has the black borders.
If there is a way to remove the background color from this dialog, i think it's good, but if it's not possilble to do this, i need something that esthetically looks like a panel in front of everything
If there is a way to remove the background color from this dialog, i think it's good, but if it's not possilble to do this, i need something that esthetically looks like a panel in front of everything
Dim cd As CustomLayoutDialog
...
Sub btnImpostaLuogoAUTO_Click
ShowGP
End Sub
...
Sub ShowGP
cd.ShowAsync("", "", "", "", Null, True)
cd.SetSize(100%x, 100%y)
Wait For Dialog_Ready (DialogPanel As Panel)
DialogPanel.LoadLayout("GooglePLaces")
DialogPanel.Color = Colors.ARGB(0,0,0,0)
End Sub
I think i already tested in the past that object, but if i'm not wrong the problem was that it doesn't shows in front of everything, anyway I will take another look now
It will show above all other views unless you added a panel with an elevation higher than 4dip (in that case you can easily change the dialog elevation).
It will show above all other views unless you added a panel with an elevation higher than 4dip (in that case you can easily change the dialog elevation).
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If ((KeyCode = 269) Or (KeyCode = KeyCodes.KEYCODE_BACK)) And (pnlDialog.Tag == False) Then
HandleBackKey
Else If (pnlDialog.Tag == True) Then
btnOkDialog_Click
Return False
Else
Return True
End If
End Sub
I saved in the pnlDialog.Tag if the dialog is shown or not (if false is it not shown, if true yes)
then in btnCloseDialog_Click i have:
B4X:
Sub btnOkDialog_Click
dialog.Close(DialogResponse.POSITIVE)
pnlDialog.Tag = False
End Sub
Edit: Before you ask, the sub "HandleBackKey" works properly (it show a classic MsgBoxAsync, if i hit "No" or "Cancel" it doensn't go back), the problem is only with the B4XDialogs
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If ((KeyCode = 269) Or (KeyCode = KeyCodes.KEYCODE_BACK)) And (pnlDialog.Tag == False) Then
HandleBackKey
Return True '<-------------------------------
Else If (pnlDialog.Tag == True) Then
btnOkDialog_Click
Return False
Else
Return True
End If
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If ((KeyCode = 269) Or (KeyCode = KeyCodes.KEYCODE_BACK)) And (pnlDialog.Tag == False) Then
HandleBackKey
Return True '<-------------------------------
Else If (pnlDialog.Tag == True) Then
btnOkDialog_Click
Return False
Else
Return True
End If
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If ((KeyCode = 269) Or (KeyCode = KeyCodes.KEYCODE_BACK)) Then
If (pnlDialog.Tag == False) then
' Dialog is Close - Close Activity
Activity.close
Else
' Dialog is Open - Close Dialog
btnOkDialog_Click
End If
Return True
Else
Return False
End If
End Sub
If the BACK button is intercepted several times, then put a sleep (300) before closing the dialog box.
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If ((KeyCode = 269) Or (KeyCode = KeyCodes.KEYCODE_BACK)) Then
If (pnlDialog.Tag == False) then
' Dialog is Close - Close Activity
Activity.close
Else
' Dialog is Open - Close Dialog
btnOkDialog_Click
End If
Return True
Else
Return False
End If
End Sub
If the BACK button is intercepted several times, then put a sleep (300) before closing the dialog box.
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_BACK Then
If dialog.Close(xui.DialogResponse_Cancel) Then Return True
End If
Return False
End Sub