Android Question b4xdialog order buttons

scsjc

Well-Known Member
Licensed User
Longtime User
Is possible change the order from buttons?
and aling the buttons :"top-left" "center" "top-right" customdialog screen?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Download XUI Views example and modify btnColors_Click to:
B4X:
Sub btnColors_Click
   'example of changing the buttons order and position
   Dim rs As ResumableSub = Dialog.ShowTemplate(ColorTemplate, "OK", "", "CANCEL")
   Dim ok As B4XView = Dialog.GetButton(XUI.DialogResponse_Positive)
   Dim cancel As B4XView = Dialog.GetButton(XUI.DialogResponse_Cancel)
   cancel.SetLayoutAnimated(0, 2dip, cancel.Top, cancel.Parent.Width / 2 - 4dip, cancel.Height)
   ok.SetLayoutAnimated(0, ok.Parent.Width / 2 + 2dip, ok.Top, ok.Parent.Width / 2 - 4dip, ok.Height)
   Wait For (rs) Complete (Result As Int)
   If Result = XUI.DialogResponse_Positive Then
       Base.Color = ColorTemplate.SelectedColor
   End If
End Sub
 
Upvote 0

scsjc

Well-Known Member
Licensed User
Longtime User
Download XUI Views example and modify btnColors_Click to:
B4X:
Sub btnColors_Click
   'example of changing the buttons order and position
   Dim rs As ResumableSub = Dialog.ShowTemplate(ColorTemplate, "OK", "", "CANCEL")
   Dim ok As B4XView = Dialog.GetButton(XUI.DialogResponse_Positive)
   Dim cancel As B4XView = Dialog.GetButton(XUI.DialogResponse_Cancel)
   cancel.SetLayoutAnimated(0, 2dip, cancel.Top, cancel.Parent.Width / 2 - 4dip, cancel.Height)
   ok.SetLayoutAnimated(0, ok.Parent.Width / 2 + 2dip, ok.Top, ok.Parent.Width / 2 - 4dip, ok.Height)
   Wait For (rs) Complete (Result As Int)
   If Result = XUI.DialogResponse_Positive Then
       Base.Color = ColorTemplate.SelectedColor
   End If
End Sub

I do not have words
Every day I am more surprised by the great advances in B4X, Many thanks
 
Upvote 0
Top