Android Question B4XFloatTextField & EventName

T201016

Active Member
Licensed User
Longtime User
Hi!
I have a question:
- how can I get "EventName" for all fields in the ShowDialog used (see: Dim ft As B4XFloatTextField):

EventName_TextChanged:
Sub EventName_TextChanged (Old As String, New As String)
    Private enabled As Boolean = New.IndexOf("serachfor") > -1 'Valid...
    If enabled Then
        PrefDialog.Dialog.GetButton(xui.DialogResponse_Positive).Enabled = enabled
        PrefDialog.Dialog.GetButton(xui.DialogResponse_Positive).TextColor = Colors.Blue
    End If
End Sub
        ...

        Dim sf As Object = Prefdlg.ShowDialog(Data, "OK", Maps.L(23,"CANCEL"))
        For i = 0 To Prefdlg.PrefItems.Size - 1
            Dim pi As B4XPrefItem = Prefdlg.PrefItems.Get(i)
            If pi.ItemType = Prefdlg.TYPE_MULTILINETEXT Then
                Dim ft As B4XFloatTextField = Prefdlg.CustomListView1.GetPanel(i).GetView(0).Tag
                ft.TextField.Font = xui.CreateDefaultBoldFont(14)
                ft.TextField.SetTextAlignment("TOP","LEFT")
                ft.lblClear.Left = -100dip
                ft.lblV.Left = -100dip
            End If
        Next
    
        Prefdlg.Dialog.GetButton(xui.DialogResponse_Positive).Enabled = False
        Prefdlg.Dialog.GetButton(xui.DialogResponse_Positive).TextColor = Colors.LightGray
        Wait For (sf) Complete (Result As Int)
 

toby

Well-Known Member
Licensed User
Longtime User
Hi!
I have a question:
- how can I get "EventName" for all fields in the ShowDialog used (see: Dim ft As B4XFloatTextField):

EventName_TextChanged:
Sub EventName_TextChanged (Old As String, New As String)
    Private enabled As Boolean = New.IndexOf("serachfor") > -1 'Valid...
    If enabled Then
        PrefDialog.Dialog.GetButton(xui.DialogResponse_Positive).Enabled = enabled
        PrefDialog.Dialog.GetButton(xui.DialogResponse_Positive).TextColor = Colors.Blue
    End If
End Sub
        ...

        Dim sf As Object = Prefdlg.ShowDialog(Data, "OK", Maps.L(23,"CANCEL"))
        For i = 0 To Prefdlg.PrefItems.Size - 1
            Dim pi As B4XPrefItem = Prefdlg.PrefItems.Get(i)
            If pi.ItemType = Prefdlg.TYPE_MULTILINETEXT Then
                Dim ft As B4XFloatTextField = Prefdlg.CustomListView1.GetPanel(i).GetView(0).Tag
                ft.TextField.Font = xui.CreateDefaultBoldFont(14)
                ft.TextField.SetTextAlignment("TOP","LEFT")
                ft.lblClear.Left = -100dip
                ft.lblV.Left = -100dip
            End If
        Next
   
        Prefdlg.Dialog.GetButton(xui.DialogResponse_Positive).Enabled = False
        Prefdlg.Dialog.GetButton(xui.DialogResponse_Positive).TextColor = Colors.LightGray
        Wait For (sf) Complete (Result As Int)
You need to renamed "EventName" to "ft", the name of the floatTextField
 
Upvote 0

T201016

Active Member
Licensed User
Longtime User
Hello,
thanks for fast reaction.

Unfortunately, with the name changed to "ft", the function does not work Sub ft_TextChanged (Old As String, New As String)
The code source is in the classes module, but it doesn't really matter?
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Unfortunately, with the name changed to "ft", the function does not work Sub ft_TextChanged (Old As String, New As String)
What does not work ?
It should work.
Set a breakpoint in the event routine to check if the event is raised.
Then you need to use the Sender object and the Tag property to know which B4XFloatTextField raised the event.
You need to give the Tag property a value, when you initialize the B4XFloatTextFields, to be able to distinguish them.
Otherwise post a small project showing the problem.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
how can I get "EventName" for all fields in the ShowDialog used (see: Dim ft As B4XFloatTextField):
I do not think you have access to the B4XFloatTextField _TextChanged event in the B4XPreferenceDialog library as the B4XFloatTextField is part of the internal layout. You would have to change the class module to make it available. But, before you listen to me, do what professore klaus recommends first.
you can do something like this:
B4X:
Dim et As EditText= ft.TextField  'expose native text view            
            If et.Text.Contains("soccer") Then
                prefdialog.Dialog.GetButton(xui.DialogResponse_Positive).Enabled = False
                prefdialog.Dialog.GetButton(xui.DialogResponse_Positive).TextColor = Colors.Gray
            End If
 
Upvote 0

T201016

Active Member
Licensed User
Longtime User
I do not think you have access to the B4XFloatTextField _TextChanged event in the B4XPreferenceDialog library as the B4XFloatTextField is part of the internal layout. You would have to change the class module to make it available.
That would be fine, because I can't access the B4XFloatTextField _TextChanged event in the B4XPreferenceDialog library.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
That would be fine
You need to do it by yourself.

XUIViews is a B4XLib. Extract the source, edit the class and put it back into (maybe another b4xlib).
 
Upvote 0
Top