B4J Question (Solved) PreferencesDialog Buttons Text

aeric

Expert
Licensed User
Longtime User
How to set the "OK" and "Cancel" button text size? The Cancel button appears as "CAN..." in Ubuntu Linux.

1632243511331.png
 
Solution
B4XPreferencesDialog uses a regular B4XDialog for the dialog.

B4X:
Dim rs As Object = p.ShowDialog(Data(0), "Ok", "CANCELLLL")
Dim btnCancel As B4XView = p.Dialog.GetButton(xui.DialogResponse_Cancel)
btnCancel.Width = btnCancel.Width + 20dip
btnCancel.Left = btnCancel.Left - 20dip
Dim btnOk As B4XView = p.Dialog.GetButton(xui.DialogResponse_Positive)
btnOk.Left = btnOk.Left - 20dip
Wait For (rs) Complete (Result As Int)

It is the same as with B4XDialog directly: https://www.b4x.com/android/forum/threads/solved-b4xinputtemplate-button-width.114021/#post-712233

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4XPreferencesDialog uses a regular B4XDialog for the dialog.

B4X:
Dim rs As Object = p.ShowDialog(Data(0), "Ok", "CANCELLLL")
Dim btnCancel As B4XView = p.Dialog.GetButton(xui.DialogResponse_Cancel)
btnCancel.Width = btnCancel.Width + 20dip
btnCancel.Left = btnCancel.Left - 20dip
Dim btnOk As B4XView = p.Dialog.GetButton(xui.DialogResponse_Positive)
btnOk.Left = btnOk.Left - 20dip
Wait For (rs) Complete (Result As Int)

It is the same as with B4XDialog directly: https://www.b4x.com/android/forum/threads/solved-b4xinputtemplate-button-width.114021/#post-712233
 
Upvote 2
Solution

aeric

Expert
Licensed User
Longtime User
1632552145532.png

Thanks. I tested with longer text.

B4X:
    Dim sf As Object = PrefDialog3.ShowDialog(Item, "OK", "CANCEL ACTION")
    Sleep(0)
    ' Fix Linux UI
    #if B4J
    Dim btnCancel As B4XView = PrefDialog3.Dialog.GetButton(xui.DialogResponse_Cancel)
    btnCancel.Width = btnCancel.Width + 80dip
    btnCancel.Left = btnCancel.Left - 80dip
    btnCancel.TextColor = xui.Color_Red
    Dim btnOk As B4XView = PrefDialog3.Dialog.GetButton(xui.DialogResponse_Positive)
    btnOk.Left = btnOk.Left - 80dip
    #End If
    Wait For (sf) Complete (Result As Int)
 
Upvote 0
Top