Android Question B4XFloatTextField enabled = false

andredamen

Active Member
Licensed User
Longtime User
I have a B4XFloatTextField that the user sometimes may not change. Simple enabled = false, but when the field has a large text in it, you can not scroll it. Has anyone find a way tot scroll such a textfield. I don't want to set enabled = true!
 

LucaMs

Expert
Licensed User
Longtime User
Rather convoluted but working method (B4J example but obviously also works in B4A and B4i).

B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI

    Private B4XFloatTextField1 As B4XFloatTextField
    Private mEditable As Boolean
    Private mRefreshing As Boolean
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
 
    mRefreshing = True
    B4XFloatTextField1.Text = "precipitevolissimevolmente"
    Sleep(0)
    mRefreshing = False
    mEditable = False
End Sub

Private Sub B4XFloatTextField1_TextChanged (Old As String, New As String)
    If Not(mEditable) Then
        If Not(mRefreshing) Then
            mRefreshing = True
            B4XFloatTextField1.Text = Old
            Sleep(0)
            mRefreshing = False
        End If
    End If
End Sub
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
?
Only Read B4A
B4X:
FloatTextField.TextField.As(EditText).InputType = FloatTextField.TextField.As(EditText).INPUT_TYPE_NONE
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
? Only Read B4J
B4X:
    If B4XFloatTextField1.TextField Is TextField Then
        B4XFloatTextField1.TextField.As(TextField).Editable = False
    End If
    If B4XFloatTextField1.TextField Is TextArea Then
        B4XFloatTextField1.TextField.As(TextArea).Editable = False
    End If
 
Upvote 0
Top