Android Question [B4X]PreferenceDialog items' height

udg

Expert
Licensed User
Longtime User
Hi all,
using FormsBuilder we can prepare a json file suitable for use by PreferenceDialog. But what if items needs to be "taller" than default height in order to fully show their text?
I mean, I have a boolean yes/no switch. Its explanatory text is somewhat long (a couple of text lines). Standard PD shows only partially given text. What to do?
I know about the explanation item, but having a bunch of them to overcome the limited default space for simple booleans doesn't seems to be ideal.

Should I access the underlying CLV to alter those panels height? Is there any "automatically adjust the height" setting buried somewhere?

Another option is obviously to design from scratch a proper layout, but I liked the idea of FB+PD working together to prepare and show in no time a simple survey.
Let me know if I simply missed the obvious or if the great couple is yet in its infancy so it could be well suited for really simple tasks but not for a more complex one.

TIA
 
Maybe it will be easier to attach the generated json. Just change its extension to "json" and add it to your PrefDialog example with a 300,400 initialization like:
Code:
prefdialog.Initialize(Activity, "Covid-19 self evaluation", 300dip, 400dip)
As said I could act on the internal CLV's panels but I guess it will be easier to compose the whole survey in a more "traditional" way.

ps: for those who can read Italian, I know there are a lot of syntax errors..I was just curious to see in no time how it appeared on my old smartphone
pps: using FB+PD it took me about 15 minutes from start to finish
 

Attachments

Upvote 0
Please find attached a screenshot as per your request
BTW, same json used in B4j (600 x ??) shows ok. That's because there's more horizontal space so those labels come in full view.

ps: didn't use before; screenshot from IDE is really nice. Thank you
 

Attachments

  • c19.png
    c19.png
    37.7 KB · Views: 843
Upvote 0
Code to increase the height of boolean items:
Code:
Dim sf As Object = p.ShowDialog(d, "OK", "CANCEL")
 p.CustomListView1.AnimationDuration = 0
For i = 0 To p.PrefItems.Size - 1
    Dim pi As B4XPrefItem = p.PrefItems.Get(i)
    If pi.ItemType = p.TYPE_BOOLEAN Then
        p.CustomListView1.ResizeItem(i, 70dip)
        Dim pnl As B4XView = p.CustomListView1.GetPanel(i)
        pnl.Height = pnl.Parent.Height
        pnl.GetView(0).Height = pnl.Height - 20dip
        pnl.GetView(1).Top = 20dip
    End If
Next
Wait For (sf) Complete (Result As Int)
 
Upvote 0
Back
Top