Android Question [Solved] B4XView.SelectionStart

Roger Daley

Well-Known Member
Licensed User
Hi All,

In B4A this works:

B4X:
'Display1 created in Designer'
Private Display1 as EditText
Display1.SelectionStart = Display1.Text.Length

When Display1 is declared as B4XView it flags "Unknown member: selectionstart"


B4X:
'Display1 created in Designer'
Private Display1 as B4XView
Display1.SelectionStart = Display1.Text.Length
It seems too simple to go wrong, but..........

Help would be much appreciated.

Regards Roger
 
Last edited:

LucaMs

Expert
Licensed User
When a member does not exist (property or method) you have to use the original view.
B4X:
    #If B4A
       Dim Disp1 As EditText = Display1
    #Else If B4J
       Dim Disp1 As TextField = Display1
    #Else If B4I
       ' I don't know, not having B4I; it should be the same of B4J
    #End If
    Disp1.SelectionStart = Disp1.Text.Length
 
Last edited:

Roger Daley

Well-Known Member
Licensed User
When a member does not exist (property or method) you have to use the original view.
B4X:
    #If B4A
       Dim Disp1 As EditText = Display1
    #Else If B4J
       Dim Disp1 As TextField = Display1
    #Else If B4I
       ' I don't know, not having B4I; it shoud be the same of B4J
    #End If
    Disp1.SelectionStart = Disp1.Text.Length

LucaMs,
Amazing, you've given me the answer but not one I would have ever had guessed.

Many Thanks Roger.
 
Top