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