[Bug] Button padding too high

Bernie

Member
Licensed User
Longtime User
Hello:

I am Bernardo, from Spain. This is my first post (b4a is incredible, congratulations).
I found a problem changing button sizes. Text dissapear, or is cut. It is possible to change padding in a button?.

Thank you!!
 

Cableguy

Expert
Licensed User
Longtime User
That only happens because you are setting the button smaller that the current text size...

Change the text sze accordingly (button height -2 sould be enough)
 

Bernie

Member
Licensed User
Longtime User
In this example:

B4X:
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

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

End Sub

Sub Activity_Create(FirstTime As Boolean)

   Dim tmpButton As Button
   
   tmpButton.Initialize("")
   tmpButton.Text="Prueba"
   
   tmpButton.TextSize=8
   
   Activity.AddView(tmpButton, 50, 50, 100, 30)
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

the text in the button is cut, and it is a padding at the top too high.

Is it possible to change this padding?

Thantks.
 

Cableguy

Expert
Licensed User
Longtime User
As exemplified by NJDude, you should append "dip" (Density Independet Pixel) to any pixel retaled values, for them to be relative to the screen reolution, and NOT absolute...
 
Top