In a B4XPages project when an edittext is clicked the Auto-fill button will pop up.
Is there any way (Java code?) to avoid this?
RBS
Is there any way (Java code?) to avoid this?
RBS
There is no relation between the project type and the behavior of views.In a B4XPages project
EditText1.InputType = Bit.Or(EditText1.InputType, 0x00080000)
I didn't think there was any relation, but thought to mention it in case it was of any relevance.There is no relation between the project type and the behavior of views.
B4X:EditText1.InputType = Bit.Or(EditText1.InputType, 0x00080000)
Sub SetEditTextInput_Type(bDoCustomKeyboard As Boolean, oEditText As EditText, iKeyBoardType As Int, bHandleAction As Boolean)
'Log("SetEditTextInput_Type, iKeyBoardType: " & iKeyBoardType)
If NativeMe.IsInitialized = False Then
NativeMe.InitializeContext
End If
If bDoCustomKeyboard Then
NativeMe.RunMethod("disableSoftKeyboard", Array As Object(oEditText))
'oEditText.InputType = Bit.Or(oEditText.InputType, 0x00080000)
Else
Select Case iKeyBoardType
Case Enums.eKeyboardStates.LowerCase, Enums.eKeyboardStates.UpperCase, Enums.eKeyboardStates.UpperCaseFixed, _
Enums.eKeyboardStates.Symbols1, Enums.eKeyboardStates.Symbols2
NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, (1 + 524288)))
Case Enums.eKeyboardStates.Numeric
NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, 2))
ime.SetCustomFilter(oEditText, oEditText.INPUT_TYPE_NUMBERS, "0123456789")
Case Enums.eKeyboardStates.Decimals
NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, (2 + 8192)))
ime.SetCustomFilter(oEditText, oEditText.INPUT_TYPE_NUMBERS, "0123456789.")
Case Enums.eKeyboardStates.NumericWithMinus
NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, (2 + 4096)))
ime.SetCustomFilter(oEditText, oEditText.INPUT_TYPE_NUMBERS, "0123456789-")
Case Enums.eKeyboardStates.DecimalsWithMinus
NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, (2 + 4096 + 8192)))
ime.SetCustomFilter(oEditText, oEditText.INPUT_TYPE_NUMBERS, "0123456789.-")
End Select
If bHandleAction Then
'will show Next button to handle the action
'will need to specify the action in ime_HandleAction
ime.AddHandleActionEvent(oEditText)
End If
End If
End Sub
As the Auto-fill only pops up when the edittext is clicked when it has the focus (cursor is visible). There is a way round this by hiding the cursorI didn't think there was any relation, but thought to mention it in case it was of any relevance.
I tried that already, but it made no difference and the reason for that is that I am using a custom keyboard
and should have mentioned that. Was hoping there was an other way to avoid the popups other than through
the InputType property.
As I have my own custom keyboard I have disabled the default custom keyboard:
B4X:Sub SetEditTextInput_Type(bDoCustomKeyboard As Boolean, oEditText As EditText, iKeyBoardType As Int, bHandleAction As Boolean) 'Log("SetEditTextInput_Type, iKeyBoardType: " & iKeyBoardType) If NativeMe.IsInitialized = False Then NativeMe.InitializeContext End If If bDoCustomKeyboard Then NativeMe.RunMethod("disableSoftKeyboard", Array As Object(oEditText)) 'oEditText.InputType = Bit.Or(oEditText.InputType, 0x00080000) Else Select Case iKeyBoardType Case Enums.eKeyboardStates.LowerCase, Enums.eKeyboardStates.UpperCase, Enums.eKeyboardStates.UpperCaseFixed, _ Enums.eKeyboardStates.Symbols1, Enums.eKeyboardStates.Symbols2 NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, (1 + 524288))) Case Enums.eKeyboardStates.Numeric NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, 2)) ime.SetCustomFilter(oEditText, oEditText.INPUT_TYPE_NUMBERS, "0123456789") Case Enums.eKeyboardStates.Decimals NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, (2 + 8192))) ime.SetCustomFilter(oEditText, oEditText.INPUT_TYPE_NUMBERS, "0123456789.") Case Enums.eKeyboardStates.NumericWithMinus NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, (2 + 4096))) ime.SetCustomFilter(oEditText, oEditText.INPUT_TYPE_NUMBERS, "0123456789-") Case Enums.eKeyboardStates.DecimalsWithMinus NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, (2 + 4096 + 8192))) ime.SetCustomFilter(oEditText, oEditText.INPUT_TYPE_NUMBERS, "0123456789.-") End Select If bHandleAction Then 'will show Next button to handle the action 'will need to specify the action in ime_HandleAction ime.AddHandleActionEvent(oEditText) End If End If End Sub
The strange thing is that when I go to a B4XPage and the edittext is clicked first time during the visit to that page then there is no popup.
Then when the keyboard is closed (via the bottom right back key) and then the edittext is clicked again then the popup appears.
I think the solution to this problem is finding out why first time all is OK and then after that not.
The above code (SetEditTextInput_Type) runs only once per edittext.
RBS
Sub SetCursorVisible(edt As EditText, Visible As Boolean)
Dim jo = edt As JavaObject
jo.RunMethod("setCursorVisible", Array As Object(Visible))
End Sub
I think I will just have to accept it as it is, unless some has some other solution.
RBS
Reading this post:There is no relation between the project type and the behavior of views.
B4X:EditText1.InputType = Bit.Or(EditText1.InputType, 0x00080000)
EditText1.InputType = Bit.Or(EditText1.InputType, 0x00080000)
Confirmed now that it has nil to do with the custom keyboard as the popup is stopped nicely on a Samsung Tab S6 Lite tablet, using the line:Reading this post:
NO_SUGGESTIONS not working on Galaxy phone
I'm trying to stop suggestions/autocomplete from suggesting words when entering a field in an editBox, like this: NameEntryBox.InputType = Bit.Or(NameEntryBox.INPUT_TYPE_TEXT,0x00080000) It works fine on most tablets, but on my galaxy S3 phone the suggestions are still there. Is there anything...www.b4x.com
Makes me think that the reason
B4X:EditText1.InputType = Bit.Or(EditText1.InputType, 0x00080000)
didn't stop the popup has nothing to do with my custom keyboard, but has to do with the phone (I am now on a Samsung S24).
Will investigate further.
RBS
EditText1.InputType = Bit.Or(EditText1.InputType, 0x00080000)
I forgot to post the Java code that does disableSoftKeyboard and enableSoftKeyboard. This is at the bottom of Main in the B4XPages project:I didn't think there was any relation, but thought to mention it in case it was of any relevance.
I tried that already, but it made no difference and the reason for that is that I am using a custom keyboard
and should have mentioned that. Was hoping there was an other way to avoid the popups other than through
the InputType property.
As I have my own custom keyboard I have disabled the default custom keyboard:
B4X:Sub SetEditTextInput_Type(bDoCustomKeyboard As Boolean, oEditText As EditText, iKeyBoardType As Int, bHandleAction As Boolean) 'Log("SetEditTextInput_Type, iKeyBoardType: " & iKeyBoardType) If NativeMe.IsInitialized = False Then NativeMe.InitializeContext End If If bDoCustomKeyboard Then NativeMe.RunMethod("disableSoftKeyboard", Array As Object(oEditText)) 'oEditText.InputType = Bit.Or(oEditText.InputType, 0x00080000) Else Select Case iKeyBoardType Case Enums.eKeyboardStates.LowerCase, Enums.eKeyboardStates.UpperCase, Enums.eKeyboardStates.UpperCaseFixed, _ Enums.eKeyboardStates.Symbols1, Enums.eKeyboardStates.Symbols2 NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, (1 + 524288))) Case Enums.eKeyboardStates.Numeric NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, 2)) ime.SetCustomFilter(oEditText, oEditText.INPUT_TYPE_NUMBERS, "0123456789") Case Enums.eKeyboardStates.Decimals NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, (2 + 8192))) ime.SetCustomFilter(oEditText, oEditText.INPUT_TYPE_NUMBERS, "0123456789.") Case Enums.eKeyboardStates.NumericWithMinus NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, (2 + 4096))) ime.SetCustomFilter(oEditText, oEditText.INPUT_TYPE_NUMBERS, "0123456789-") Case Enums.eKeyboardStates.DecimalsWithMinus NativeMe.RunMethod("enableSoftKeyboard", Array As Object(oEditText, (2 + 4096 + 8192))) ime.SetCustomFilter(oEditText, oEditText.INPUT_TYPE_NUMBERS, "0123456789.-") End Select If bHandleAction Then 'will show Next button to handle the action 'will need to specify the action in ime_HandleAction ime.AddHandleActionEvent(oEditText) End If End If End Sub
The strange thing is that when I go to a B4XPage and the edittext is clicked first time during the visit to that page then there is no popup.
Then when the keyboard is closed (via the bottom right back key) and then the edittext is clicked again then the popup appears.
I think the solution to this problem is finding out why first time all is OK and then after that not.
The above code (SetEditTextInput_Type) runs only once per edittext.
RBS
#IF JAVA
import android.widget.EditText;
import android.os.Build;
import android.text.InputType;
public void disableSoftKeyboard(final EditText v) {
if (Build.VERSION.SDK_INT >= 11) {
v.setRawInputType(InputType.TYPE_CLASS_TEXT);
v.setTextIsSelectable(true);
v.setShowSoftInputOnFocus(false);
} else {
v.setRawInputType(InputType.TYPE_NULL);
v.setFocusable(true);
}
}
public static void enableSoftKeyboard(final EditText v, int iKeyBoardType) {
if (Build.VERSION.SDK_INT >= 11) {
v.setRawInputType(iKeyBoardType);
v.setTextIsSelectable(true);
v.setShowSoftInputOnFocus(true);
} else {
v.setRawInputType(iKeyBoardType);
v.setFocusable(true);
}
}
#END IF
Actually on that Samsung Tab S6 Lite the popup wasn't there even without that line:Confirmed now that it has nil to do with the custom keyboard as the popup is stopped nicely on a Samsung Tab S6 Lite tablet, using the line:
B4X:EditText1.InputType = Bit.Or(EditText1.InputType, 0x00080000)
It looks I need to be able to manipulate that popup.
RBS
EditText1.InputType = Bit.Or(EditText1.InputType, 0x00080000)