How do I show a text cursor to a ReadOnly textbox?

How can I show a cursor to readOnly textbox?

This is important as I am making a custom keyboard

You can't. You have to remove the read only checkbox/property. Then this makes the android keyboard show up. You can hide this with the Hide keyboard block.

It is possible to use a label instead of a textbox, and set a "cursor" in the text, but the blocks are complex and the user experience is not great.

1 Like

But then I need a textbox click event. It comes also when clicking the textbox. Just now I tested with companion. How can I have a click event? Can you please also help me with that. So I can add that hide keyboard block...

Have a button, disguised as a TextBox - on click, hide the button, show the TextBox (Or Label).

2 Likes

With this extension you can add click event on textbox

2 Likes

Use a clock timer to hide the keyboard while the textbox is in edit mode/has focus. It will flash on the the screen. Remember to turn off the clock when focus is lost/editing finished.

1 Like

I think the structure is like this... :





blocks

are my blocks correct?

No, because you do not start the clock :wink:

You would also need another textbox to take the focus in order to stop the clock.

2 Likes

I've got one question - when will you fire the Clock1. Timer event?

EDIT: I see you fixed it now.

1 Like

@TIMAI2 I fixed the blocks!

But one question. Why does the textbox appear for 1 second and then go away? Maybe it's because of the companion, right?

@Gordon_Lu The timer is fired when the TextBox is in edit mode!

Following on from @ChrisWard 's suggestion about using a button, here is a small example
buttonastext.aia (2.7 KB)

There is no blocks keyboard to edit the text but you should see how it works. Another button is needed to close the textbox.

1 Like

Couldn't Button2 actually be a 'when TextBox lost focus' Block?

Actually, it's not a solution - every time you edit the text, the keyboard still 'flashes up', 'call TextBox HideKeyboard' needs to behave differently - Hide until enabled (by code instead of event).

1 Like

You would need an extension for that.

1 Like

Can you please suggest me an extension then?

@ChrisWard already has....:wink:

https://community.appinventor.mit.edu/t/extension-suggestion-hide-system-keyboard/50356/2

1 Like

Yeah :smiley: . But wish someone creates one as @ChrisWard suggested :slight_smile: ...