I have a TextField that will hold a path (several textfields to do the same), this presents no problem, except that only the initial part of the path is visible (Leftmost) and if the path is bigger that the textfield width, I have no idea of what the rest of the path looks like.
How can I force the textfield to show the rightmost part of the path without having to trim it?
The only way I could find to display the tail of the text is a bit of a hack, I couldn't find any methods to help. You could easily wrap it into a customview. The full text is stored in the textfields tag.
You can bind the textfield.text value to the tooltip.text so they are always in sync without the need to change the tooltip text in textfield.textchanged event.
Using javaobject
B4X:
...
asJO(tf).RunMethodJO("textProperty",Null).RunMethod("bindBidirectional",Array(asJO(tf).RunMethodJO("getTooltip",Null).RunMethodJO("textProperty",Null)))
...
Sub asJO(o As JavaObject)As JavaObject
Return o
End Sub
I have found that adding the css in the designer has no effect, and adding it in code using TextField.Style overruns all my previous css styling rendering the view in default css visualy!
I get the same result, but I decided to solve the original question the hard way and created a small sub to trim a passed string to length
B4X:
Private Sub TextToRight (Text As String) As String
If Text.Length < 40 Then Return Text
Dim newText As String = Text.SubString2(Text.Length - 40, Text.Length)
newText =".." & newText.SubString(newText.IndexOf("\"))
Return newText
End Sub