Suggested Extension: Custom Cursors for TextBox Component

  1. An extension that gives the App Developer a selection of cursors to choose from and if possible also allow the App User to select cursors.

  2. An advanced version that allows App Developer/App User to define their own cursor using an image (.png).

3 Likes

Great suggestion :+1: - I will start working on this immediately.

2 Likes

This can be helpful for you.

2 Likes

Here is also another approach.

This is possible with Kodular by setting AccentColor accordingly.

1 Like

Yes, it is in the Kodular documentation, bbut I don't think this applies to App Inventor (although App Inventor does have an AccentColor property as well.).

You are going to create the extension right? If you aren't then i will give a try.

I am trying to implement the cursor features in this extension. Currently testing.

EDIT: Verified not working. Failed attempt.

1 Like

you might show current code maybe you are doing something wrong?

I removed the code already unfortunately. :disappointed_relieved: Same as this.

public void ColorFilter(int color) {
Drawable drawable = view.getBackground(); // get current EditText drawable
drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); // change the drawable color

if(Build.VERSION.SDK_INT > 16) {
  view.setBackground(drawable); // set the new drawable to EditText
}else{
  view.setBackgroundDrawable(drawable); // use setBackgroundDrawable because setBackground required API 16
}
view.invalidate();

}

Maybe try this one :grinning_face_with_smiling_eyes:

2 Likes

I tested, it instead filled the BackgroundColor of the TextBox.

We already have BackgroundColor for Textbox, don't we?

TextCursorDrawable is added on API 29. You can use the getter and setter properties.

Example :

EditText editText =...;
public void SetCursorColor(int color){
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
            editText.setTextCursorDrawable(//drawable or intDrawableResId);
            return;
        }
}

Before API 29, Only a solution is using java reflection.

1 Like