B4J Question PreferenceDialog - Options field - center/left/right

DarkoT

Active Member
Licensed User
Hi, Need little help. I'm using a preference dialog which loads Json structure for input data and have little problem with displaying choice options. Is possible to define the position of the chosen option; now is the right aligned. Can I define the left, center, right alignment of choice item?

2023-06-06_20h19_14.png
 
Solution
B4X:
'p is the B4XPreferencesDialog
Dim rs As Object = p.ShowDialog(Data(0), "Ok", "CANCEL")

For i = 0 To p.PrefItems.Size - 1
    Dim pi As B4XPrefItem = p.PrefItems.Get(i)
    If pi.ItemType = p.TYPE_OPTIONS Then
        Dim lbl As B4XView = p.CustomListView1.GetPanel(i).GetView(1)
        lbl.SetLayoutAnimated(0, lbl.Parent.Width - 300dip, lbl.Top, 290dip, lbl.Top)
        lbl.SetTextAlignment("CENTER", "CENTER")
    End If
Next

Wait For (rs) Complete (Result As Int)

1686116460492.png

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
'p is the B4XPreferencesDialog
Dim rs As Object = p.ShowDialog(Data(0), "Ok", "CANCEL")

For i = 0 To p.PrefItems.Size - 1
    Dim pi As B4XPrefItem = p.PrefItems.Get(i)
    If pi.ItemType = p.TYPE_OPTIONS Then
        Dim lbl As B4XView = p.CustomListView1.GetPanel(i).GetView(1)
        lbl.SetLayoutAnimated(0, lbl.Parent.Width - 300dip, lbl.Top, 290dip, lbl.Top)
        lbl.SetTextAlignment("CENTER", "CENTER")
    End If
Next

Wait For (rs) Complete (Result As Int)

1686116460492.png
 
Upvote 0
Solution

DarkoT

Active Member
Licensed User
B4X:
'p is the B4XPreferencesDialog
Dim rs As Object = p.ShowDialog(Data(0), "Ok", "CANCEL")

For i = 0 To p.PrefItems.Size - 1
    Dim pi As B4XPrefItem = p.PrefItems.Get(i)
    If pi.ItemType = p.TYPE_OPTIONS Then
        Dim lbl As B4XView = p.CustomListView1.GetPanel(i).GetView(1)
        lbl.SetLayoutAnimated(0, lbl.Parent.Width - 300dip, lbl.Top, 290dip, lbl.Top)
        lbl.SetTextAlignment("CENTER", "CENTER")
    End If
Next

Wait For (rs) Complete (Result As Int)

View attachment 142673
Tnx @Erel, this works perfects...
 
Upvote 0
Top