Android Question Textaligment by code

Guenter Becker

Active Member
Licensed User
Longtime User
Hello hope you are fine
In my current project I have to use a custom designarable class that adds a EditTextView as a panel child and the panel to the mBase by code. If using this custom control in the designer the properties of the textbox are no longer direct available. Therefore I have to implement them by custom properties. I did this and it works fine except Textaligment. I tried several ways but I did not find a working solution.

Last used code:
Select Case mProps.Get("TextHorizontalAlignment")
        Case "LEFT":Textbox.Gravity =  Bit.Or(Gravity.TOP, Gravity.LEFT)
        Case "CENTER_HORIZONTAL": Textbox.Gravity = Bit.Or(Gravity.TOP, Gravity.CENTER_HORIZONTAL)
        Case "RIGHT":Textbox.Gravity = Bit.Or(Gravity.RIGHT, Gravity.TOP)
    End Select
    Select Case mProps.Get("TextVerticalAlignment")
        Case "TOP" : Textbox.Gravity = Bit.Or(Gravity.LEFT, Gravity.TOP)
        Case "CENTER_VERTICAL": Textbox.Gravity = Bit.Or(Gravity.TOP, Gravity.CENTER_VERTICAL)
        Case "BOTTOM":Textbox.Gravity = Bit.Or(Gravity.LEFT, Gravity.BOTTOM)
    End Select

Could you please have a look on that code above and tell me whats going wrong. No compiling errors but it is not working.
Is something wrong? Having a better way to do it (B4A Code Snippet )?

Thank you for that christmas present and please stay away from corona.
 

Guenter Becker

Active Member
Licensed User
Longtime User
Whish you a happy christmas, opened your "parcel" and it works! thank you.
 
Upvote 0
Top