Android Question Dialog with DateTemplate

Sergey_New

Well-Known Member
Licensed User
Longtime User
I need help using a Dialog with DateTemplate. The dialog has three buttons. How can I make it so that clicking one of the buttons doesn't close the dialog, but instead launches a specific function?
 

zed

Well-Known Member
Licensed User
Create a custom layout.

Try this
B4X:
Sub ShowDateDialog
    Dim Dialog As B4XDialog
    Dialog.Initialize(Activity)

    ' Load your custom layout
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, 300dip, 400dip)
    p.LoadLayout("dlg_date") ' <-- custom layout

    Dim DateTemp As B4XDateTemplate
    DateTemp.Initialize
    PanelDate.AddView(DateTemp.Base, 0, 0, PanelDate.Width, PanelDate.Height)

    ' Use ShowCustom to do not display the dialog buttons
    Wait For (Dialog.ShowCustom(p, "", "", "")) Complete (Result As Int)
End Sub

Managing clicks without closing the dialog

B4X:
Sub btnOK_Click
    Log("OK")
  
End Sub

Sub btnAction_Click
    Log("Action")
    ' Ton code ici
End Sub

Sub btnCancel_Click
    Log("Cancel")
    Dialog.Close(xui.DialogResponse_Cancel)
End Sub
 
Upvote 0

zed

Well-Known Member
Licensed User
That's an old code. Excuse me.


B4X:
 Dim DateTemp As B4XDateTemplate
 DateTemp.Initialize
 
 ' Use ShowCustom to do not display the dialog buttons
  Wait For (Dialog.ShowCustom(p, "", "", "")) Complete (Result As Int)
 
Upvote 0
Top