Android Question Problem with AnotherDatePicker

RVP

Active Member
Licensed User
I have an app that has been running for a couple of years, the client I developed this for just noticed a strange issue. They have installed it on some new phones that have slightly lower resolution screens than they were using previously, and now some fields are cutting the text off in the display. I have tracked this down to any field that a AnotherDatePicker has been attached to. This app uses V 1.11 of AnotherDatePicker, I tried to update to a newer version thinking that something may have been done to correct this issue, however the ability to attach a DatePicker to a text field in code has been removed (AddToActivity) , in any case looking thru the code it doesn't appear that anything is done to the label the date is displayed in other than set the Text value.

Here is an example of the display The Date field has a AnotherDatePicker attached, the Date Thru Field has had the code to add the datepicker commented out. (Code shown at the bottom)

I use a script in the Designer for this activity to size and place all of the fields.

Any idea why the difference in the display?

datepicker.png


B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Dim bar As StdActionBar
    Private lblTotal As Label
    Private Panel2 As Panel
    Private txtEDate As Label
    Private txtSDate As Label
    
    Private viewDate1 As AnotherDatePicker
    Private viewDate2 As AnotherDatePicker
        
    Dim tblTime As Table
    Dim tblTime2 As Table
    Private btnGo As Button
    Private txtTotal As Label
    Private Panel4 As Panel
    Private Panel3 As Panel
    Private Panel1 As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("TimeReview")
    
    Activity.Title="Time Transaction Inquiry"
    bar.Initialize("bar")
    ' bar.Icon = LoadBitmap(File.DirAssets, "tool-kit-icon.png")
    bar.ShowUpIndicator = True
    Activity.AddMenuItem3("","mnuSend", LoadBitmap(File.DirAssets, "arrow_up.png"), True)
        
    DateTime.DateFormat = "yyyy-MM-dd"   

    viewDate1.Initialize(Me,"viewDate1")
    viewDate1.AddToActivity(Activity,txtSDate)
    

    
    'viewDate2.Initialize(Me,"viewDate2")
    'viewDate2.AddToActivity(Activity,txtEDate)
    
    txtSDate.Color = Colors.Black 'set colors manually after connecting DatePicker as Designer is ignored at this point'
    txtEDate.Color = Colors.Black
    txtSDate.TextColor = Colors.White
    txtEDate.TextColor  = Colors.White
    txtSDate.Gravity = Gravity.CENTER
    txtEDate.Gravity = Gravity.CENTER
 

RVP

Active Member
Licensed User
However the text size is exactly the same on the two shown fields, and it doesn't appear that AnotherDatePicker does anything to the text size of the attached label
 

LucaMs

Expert
Licensed User
Did some tests.

Why do you need txtSDate and txtEDate? ADP adds its own view (named targetLabel).
Then, the problem is in your txtSDate, if I have understood well; what does ADP have to do with it?
 

RVP

Active Member
Licensed User
I am not adding the date field in designer but rather in code, why, because when I first did this program designer was not supported. This is only one small instance in this app where date fields are used. While I could go thru all of the programs and replace the current fields with designer fields, that will take several hours of work. And none of it explains why attaching the date picker to the label suddenly changes the way text is displayed.
 

LucaMs

Expert
Licensed User
I am not adding the date field in designer but rather in code, why, because when I first did this program designer was not supported. This is only one small instance in this app where date fields are used. While I could go thru all of the programs and replace the current fields with designer fields, that will take several hours of work. And none of it explains why attaching the date picker to the label suddenly changes the way text is displayed.
Well, then I would need the old version of ADP.
Anyway, the two labels are identical, right? So if ADP changed the text size of the first label (and I don't think it does) it would also do it on the second.
 

RVP

Active Member
Licensed User
On the second label, for the shown program, I commented out setting up the ADP field and attaching to the label in order to show the difference in the display. If I attach a ADP to it the display is cutoff the same as the first label.
 

LucaMs

Expert
Licensed User
Compare the two labels (why "txt" as prefix?):

.........txtSDate....................txtEDate
1578694505884.png
1578694536633.png


1578694630799.png
1578694656641.png
 

LucaMs

Expert
Licensed User
Commenting this line in AnotherDatePicker class:

' Lbl.BACKGROUND = et.BACKGROUND

it seems to look "good".

Note that I changed the layout; adjust it, if you need.
 

Attachments

RVP

Active Member
Licensed User
Thanks, I’ll try that. I noticed the same issue seems to occur on a masked text box when added in code. I will try changing those instances to designer added fields as I don’t have as many of them. If I still see the issue, Ill let you know.
 

RVP

Active Member
Licensed User
ADP is good now, MaskedEditText has the same issue even if added thru designer.
 
Top