B4J Question How can I make a simple cross platform dialog with Heading message and Yes No Cancel

rgarnett1955

Active Member
Licensed User
Longtime User
Hi,

I have been trying to use the B4XDialog to make a Yes No Cancel Dialog with a Label as a title and three buttons. But I have been unable to do this.

Snag_58bbe1a.png


I tried something like this but it doesn't work. I think is has something to do with dialog templates.

Close Function with dialog:
'============================================================================================
Private Sub MainForm_Close
    If clockRunning = False Then

        Dim p As B4XView = xui.CreatePanel("")
        p.SetLayoutAnimated(0, 0, 0, 252dip, 455dip)
        p.LoadLayout("CustomDialog.bjl")
        dialog.PutAtTop = True 'put the dialog at the top of the screen
        Dim rs As ResumableSub = dialog.ShowCustom(p, "OK", "NO", "CANCEL")
        Wait For (rs) Complete (Result As Int)

        Select Result
            Case xui.DialogResponse_Positive
                rbtnRunClock_SelectedChange(True)
            Case xui.DialogResponse_Negative
                
            Case xui.DialogResponse_Cancel
                Return
        End Select
        
    End If
    mcuc.socketClose
    Toast.SetTMDefaults
    'set red backgroud, thick blue border with radius
    Toast.SetTMBackground(fx.Colors.Yellow, 4, fx.Colors.Black, 4)
    'set text size to 24, aligned left (horizontal) and center (vertical), white color
    Toast.SetTMTextProp(24,Toast.HPOS_LEFT,Toast.VPOS_CENTER,fx.Colors.Black)
    Toast.TMShow("Please Start the Shortt Bridge before closing this app", True, True)

    Sleep(5000)
    

Any ideas 

Regards
Rob
    MainForm.Close
End Sub
 
Top