Android Question How to make OPTIONS Name hint to behave like NUMBER Amount hint in preference dialog ?

AnandGupta

Expert
Licensed User
Longtime User
Since my Options list have longer names I made few adjustment to solution below, to get full width for the text.

But I noted that the Name hint text does not go up and become smaller like the Amount hint, see image,


How to make OPTIONS Name hint to behave like NUMBER Amount hint ?
so that even bigger name fits here.
 

asales

Expert
Licensed User
Longtime User
Is because Number (text) is a B4XFloatTextField and Options is a B4xView.
I think, unless you change the source code of the B4xPreferencesDialog, you will don't get this behaviour in Options.
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
Is because Number (text) is a B4XFloatTextField and Options is a B4xView.
I think, unless you change the source code of the B4xPreferencesDialog, you will don't get this behaviour in Options.
Okay.

Still I hope some miracle happens and I do not have to fiddle around ?
Actually the helps I got till now on preference dialog that I think I do not need to go and look into the codes.
Many thanks to you (@asales) and @Mahares ?
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Okay.

Still I hope some miracle happens and I do not have to fiddle around ?
I like the B4xPreferencesDialog to create a form quickly, but in some aspects is limited comparated a create a form manually in a layout.

Options like this would be a great addition.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Actually the helps I got till now on preference dialog that I think I do not need to go and look into the codes.
How about adding code to raise the word option and have its space available for real long names. See below:
B4X:
If pi.ItemType = prefdialog.TYPE_OPTIONS Then
            Dim lbl As B4XView = prefdialog.CustomListView1.GetPanel(i).GetView(1)
            lbl.SetLayoutAnimated(0, lbl.Parent.Width - 65%x, lbl.Top, 200dip, lbl.Height)
       
'Add the below code:
Dim myoptions As B4XView =  prefdialog.CustomListView1.GetPanel(i).GetView(0)
            Dim y As Int = myoptions.Top
            myoptions.setLayoutAnimated(0,0,y-20dip, myoptions.Width, myoptions.Height)
            myoptions.TextSize = 12
end if
Not sure if this is acceptable to our friend Mr. Gupta.
 
Last edited:
Upvote 0

Mahares

Expert
Licensed User
Longtime User
But it does not work like NUMBER. It shows smaller text at top, then vanishes next time.
It does not work like the number because it is not really a hint. It is a B4XView (label). My intent was simply to give you more room in the left side for long text selection. This is the full code I used. It is just a workaround, not a replacement for hint

B4X:
 Private Sub btnOptions3_Click
    Dim sf As Object = prefdialog.ShowDialog(Options3, "OK", "CANCEL")    
  For i = 0 To prefdialog.PrefItems.Size - 1
        Dim pi As B4XPrefItem = prefdialog.PrefItems.Get(i)    
        If pi.ItemType = prefdialog.TYPE_OPTIONS Then
            Dim lbl As B4XView = prefdialog.CustomListView1.GetPanel(i).GetView(1)
            lbl.SetLayoutAnimated(0, lbl.Parent.Width - 75%x, lbl.Top, 400dip, lbl.Height)
            Dim myoptions As B4XView =  prefdialog.CustomListView1.GetPanel(i).GetView(0)
            Dim y As Int = myoptions.Top
            myoptions.setLayoutAnimated(0,0,y-20dip, myoptions.Width, myoptions.Height)
            myoptions.TextSize = 12  'can be changed
        End If
    Next
  
    Wait For (sf) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
      
        PrintOptions(Options3, TextArea3)
      
    End If
End Sub
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…