B4J Question B4X view: text field with a button

peacemaker

Expert
Licensed User
Longtime User
Hi, All

Do we have a ready cross-platform view: a text edit field with an extra button (for custom click event) at the right side ?
 

peacemaker

Expert
Licensed User
Longtime User
Just a view to choose the folder path is needed. I guess, the button is the must with a custom text and action, placing the path into the text field.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Hi, All

Do we have a ready cross-platform view: a text edit field with an extra button (for custom click event) at the right side ?
B4XFloatTextField shows several "buttons" (labels actually) at the right side.

1774293346718.png


B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
 
    B4XFloatTextField1.HintText = "Select folder"
    B4XFloatTextField1.Update
    B4XFloatTextField1.lblV.Text = Chr(0xE24D)
    B4XFloatTextField1.lblV.TextColor = xui.Color_Blue
    B4XFloatTextField1.Text = " "
    B4XFloatTextField1.RequestFocusAndShowKeyboard
End Sub

Private Sub B4XFloatTextField1_EnterPressed
    Dim DC As DirectoryChooser
    DC.Initialize
    Dim SelectedDir As String
    SelectedDir = DC.Show(B4XPages.GetNativeParent(Me))
    If SelectedDir.Length = 0 Then
        SelectedDir = " "
    End If
    B4XFloatTextField1.Text = SelectedDir
    B4XFloatTextField1.RequestFocusAndShowKeyboard
End Sub

Note that this is a gimmick, the functionality is not the best.
 
Last edited:
Upvote 0
Top