Android Question B4XPreferencesDialog - item visibility - SOLVED

Smee

Well-Known Member
Licensed User
Longtime User
Is it possible to make an item (Numeric Range Box) temporarily visible\invisible programmatically? I have searched the forum for quite some time but cannot find anything

The only 2 options that looked promising were

B4X:
prefdialog.SetOptions(2,map)

and

prefdialog.GetPrefItem(2).Extra(map)


But I was unable to get any results doing this

Thanks for any help


UPDATE:

Ok I found a solution literally 2 minutes after posting when I found Erel's code here How to hide "cancel/confirm" buttons

FWIW the coded solution is

Hide an item in Preferences Dialog:
    Dim d As Map=CreateMap()
    d.Initialize
    Dim sf As Object = prefdialog.ShowDialog(d, "OK""CANCEL")
    For i = 0 To prefdialog.PrefItems.Size - 1
        Dim pi As B4XPrefItem = prefdialog.PrefItems.Get(i)
        prefdialog.CustomListView1.AnimationDuration = 0
        If pi.ItemType = prefdialog.TYPE_NUMERICRANGE Then
            If pi.Key=2 Then
                Dim pnl As B4XView = prefdialog.CustomListView1.GetPanel(i)
                pnl.Visible=False
                i=prefdialog.PrefItems.Size - 1
            End If
        End If
    Next
    Wait For (sf) Complete (Result As Int)
 
Last edited:
Top