Android Code Snippet [B4X] [XUI] Change the OK-Cancel buttons order in B4XDialog

Discussion in 'Code Snippets' started by skrjabin, Mar 4, 2019.

  1. skrjabin

    skrjabin Active Member Licensed User

    OK-Cancel or Cancel-OK, what to prefer in dialogs? It depends on the guidelines and it should be flexible. That's why I did this small modification in the B4XDialog library and I hope, that something like that could be integrated in the official one.

    Add in Class_Globals
    Code:
    Public ButtonsYesToRight As Boolean
    Modify the Sub ShowCustom (Content As B4XView, Yes As Object, No As Object, Cancel As Object) As ResumableSub
    Code:
    If ButtonsYesToRight Then
         CreateButton(Yes, xui.DialogResponse_Positive)
         CreateButton(No, xui.DialogResponse_Negative)
         CreateButton(Cancel, xui.DialogResponse_Cancel)
    Else
         CreateButton(Cancel, xui.DialogResponse_Cancel)
         CreateButton(No, xui.DialogResponse_Negative)
         CreateButton(Yes, xui.DialogResponse_Positive)
    End If
    And you use it like
    Code:
    Dim Dialog As B4XDialog
    Dialog.Initialize (Base)
    Dialog.Title = 
    "XUI Views"
    Dialog.ButtonsYesToRight = 
    True
     
    asales and ShaneG30 like this.
  2. skrjabin

    skrjabin Active Member Licensed User

    From now (version 1.88) you can do it in the original XUI Views with the ButtonsOrder.
    Code:
    Dialog.ButtonsOrder = Array As Int(XUI.DialogResponse_Negative, XUI.DialogResponse_Cancel, XUI.DialogResponse_Positive)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice