Android Question B4XDialog position on screen and prevent dialog from closing

stanks

Active Member
Licensed User
Longtime User
How to set position of B4XDialog on screen e.g. left bottom corner?
How to prevent dialog from closing when user taps on button cancel?

Thanks
 

Mahares

Expert
Licensed User
Longtime User
How to set position of B4XDialog on screen e.g. left bottom corner?
Put it on a panel and move the panel around:
B4X:
Dim p As B4XView = xui.CreatePanel("mypanel")
    Activity.AddView(p,0,60%y,300dip,40%y)
    dialog.Initialize(p)
For disabling the CANCEl, can you just hide it like this and not show it:
Wait For (dialog.ShowTemplate(input, "OK", "", "")) Complete (Result As Int)
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
How to set position of B4XDialog on screen e.g. left bottom corner?
How to prevent dialog from closing when user taps on button cancel?

Thanks

B4X:
    Dim sf As Object = xDlg.Show("Text", "Yes", "No", "")
    xDlg.Base.Left = 10dip
    xDlg.Base.Top = 10dip
    Wait For (sf) Complete(Result As Int)
    If Result = xui.DialogResponse_Cancel Then
       
    End If

You can prevent the Cancel button from appearing, as I did above, by passing an empty string as the button text.

Or you could display the dialog again if Cancel is pressed (but that certainly wouldn't look good).
 
Upvote 0
Top