B4J Question (Solved) Show selected item with PreferencesDialog

LGS

Member
Licensed User
Longtime User
Hello everyone
I am using PreferencesDialog and I need to display a selected item in the list

I tried this:
I tried this::
Private Sub Button1_Click
    Dim mapDaten As Map
    mapDaten.Initialize
    Private prefdialog As PreferencesDialog
    prefdialog.Initialize(Root, "Preferences Dialog", 300dip, 300dip)
    For x = 1 To 5
        prefdialog.AddBooleanItem(x,"Item "&x)
        If x = 3 Then
            mapDaten.Put(x, True) 'Item 3 (I need it to appear selected)
        End If
    Next
    
    Wait For (prefdialog.ShowDialog(mapDaten, "OK", "CANCEL")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        For Each key As String In mapDaten.Keys
            Dim marcado As Boolean =  mapDaten.GetDefault(key, False)
            If marcado Then
                Log(key&" selected")
            End If
        Next
    End If
End Sub

1713667530363.png

But I have not been able to make an item appear selected

I appreciate the support
 
Top