B4J Question Howto get textfield Height including border

Marc De Loose

Member
Licensed User
Longtime User
Right now when I have a pane containing a textfield(view) it chops off the bottom border of the textfield.

Its puzzling me. And I dont find a solution
 

Marc De Loose

Member
Licensed User
Longtime User
I just made a simple representation of what I did. Its no more than mBase.Height = mTxtV.Heigth.
I think it is a rounding thing. the pane rounds different than a TextField.

I worked around it by using mBase.Height = round(mTxtV.Height).

B4X:
Sub CLass_globals
    Public mBase As B4XView
    Public mTxtV             As B4XView
end sub

Public Sub AddToParent


    mLeft = 0
    mTop = 0

    mBase = xui.CreatePanel("mBase")
    mParent.AddView(mBase, mLeft, mTop, 0, 0)

    Dim txtV As TextField
    txtV.Initialize("txtV")
    mBase.AddView(txtV,0,0,mWidth,mHeight)
    mTxtV=txtV
    mTxtV.SetTextAlignment("CENTER","LEFT")
    mTxtV.Enabled=False

end sub

sub whatever

    (DO some resizing of mTxtV)
    mBase.Width  = mTxtV.Width
    mBase.Height = mTxtV.Height  ' <------ and this not always give correct results

end sub
 
Upvote 0
Top