Android Question EditText SelectText event in B4A?

RB Smissaert

Well-Known Member
Licensed User
Longtime User
To deal with the keyboard I needed an event for selecting a text (so SelStart < SelEnd) in an EditText.
Couldn't find this, but found this Java code (from Erel), which works fine:

B4X:
#if Java
import android.view.*;
import anywheresoftware.b4a.AbsObjectWrapper;
import android.text.Selection;
 import android.widget.EditText;
    @Override
public void onActionModeStarted(ActionMode mode) {
processBA.raiseEvent(this, "edittext_selecttext", AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), mode),
AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.ConcreteViewWrapper(), getCurrentFocus()));
super.onActionModeStarted(mode);
    }
    @Override
public void onActionModeFinished(ActionMode mode) {
super.onActionModeFinished(mode);
    }
#End If

Is this indeed the only way to handle this?

RBS
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…