B4J Question [BANano] SKTextBox add suffix (solved)

angel_

Well-Known Member
Licensed User
Longtime User
How can you add a suffix at the end of the text like: km, @gmail.com...
 
Solution
Thank you for the donation!

- I can add the suffix by code if the SKTextBox was added in the abstract designer?
No, the decision what type you want to use has to be made before it is added to the DOM. So either it has a suffix, or it does not. This is because in html it needs wrapper tags around the input.

- Is it possible to add suffix and keep label, either by code or in abstract designer?
Currently no. I will have to look into the lib to see if it is possible. I think using an extra SKLabel is probably your best solution for now.

alwaysbusy

Expert
Licensed User
Longtime User
With the AfterText property.

In the Abstract Designer:
1661239292323.png


By code:
B4X:
Dim txt1 As SKTextBox
txt1.Initialize(Me, "txt1", "txt1")
txt1.AfterText = "km"
txt1.AddToParent("body")
' has to be set after AddToParent
txt1.Style = $"{"width":"100%"}"$

Alwaysbusy
 
Upvote 0

angel_

Well-Known Member
Licensed User
Longtime User
Perfect thanks, just two more questions:

- I can add the suffix by code if the SKTextBox was added in the abstract designer?
- Is it possible to add suffix and keep label, either by code or in abstract designer?

[Donation made, Id. 61F395640G0886608, great BANano!!]
 
Last edited:
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Thank you for the donation!

- I can add the suffix by code if the SKTextBox was added in the abstract designer?
No, the decision what type you want to use has to be made before it is added to the DOM. So either it has a suffix, or it does not. This is because in html it needs wrapper tags around the input.

- Is it possible to add suffix and keep label, either by code or in abstract designer?
Currently no. I will have to look into the lib to see if it is possible. I think using an extra SKLabel is probably your best solution for now.
 
Upvote 0
Solution
Top