News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

[r12275] Can't use text select tools on Android

Started by Mishasama, September 15, 2026, 05:52:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mishasama

In a text box, you cannot use the soft keyboard or the native Android method to select specific text content for copying or cutting.

By the way, I'm using Gboard.
Because of some reason. I am looking for volunteers who can help me update the Pak64.Nightly.

I'm helping to build the Chinese community for now.
如果您是使用中文的玩家,歡迎到這裏尋找同好或張貼您們組織的聯係方式。
如果你是中文玩家,欢迎来这个帖子里找组织或者贴出你们的联系方式。

prissi

#1
I have set env_t::hide_keyboard to false, which generates again SDL_StartTextInput(). But it may now that you cannot hide the keyboard any more. Please test the next nightly on Android (should be r12277).

Mishasama

Quote from: prissi on September 16, 2026, 06:33:30 AMI have set env_t::hide_keyboard to false, which generates again SDL_StartTextInput(). But it may now that you cannot hide the keyboard any more. Please test the next nightly on Android (should be r12277).
Tested under r12278.

The copy and paste function is still unavailable; currently, only text selection is possible.

And it has been confirmed that the on-screen keyboard can be closed using the back button.
Because of some reason. I am looking for volunteers who can help me update the Pak64.Nightly.

I'm helping to build the Chinese community for now.
如果您是使用中文的玩家,歡迎到這裏尋找同好或張貼您們組織的聯係方式。
如果你是中文玩家,欢迎来这个帖子里找组织或者贴出你们的联系方式。

prissi

We already use SDL_copy() and SDL_paste(), so Cntrol+C (...) should copy to the Andriod Clipboard. However, if I trust Gemini, Gboard uses a different, higher API than the standard API SDL2 uses for text input and clipboard.

Mishasama

Quote from: prissi on September 19, 2026, 08:43:52 AMHowever, if I trust Gemini, Gboard uses a different, higher API than the standard API SDL2 uses for text input and clipboard.
The problem is that without a physical keyboard on Android, it's currently impossible to access the text command menu by long-pressing. As a result, actions like copying and pasting are unavailable.

I think most on-screen keyboards that offer similar functionality use the same system API, not limited to Gboard. And it's unlikely they would use a non-native solution like SDL2.

Perhaps we could consider providing shortcut keys for frequently used functions on the toolbar, similar to the CTRL key?
Because of some reason. I am looking for volunteers who can help me update the Pak64.Nightly.

I'm helping to build the Chinese community for now.
如果您是使用中文的玩家,歡迎到這裏尋找同好或張貼您們組織的聯係方式。
如果你是中文玩家,欢迎来这个帖子里找组织或者贴出你们的联系方式。

prissi

SDL is foremost a game library, trying to get keystrokes as fast as possible and thus not so well suited for normal texthandling, which was hacked on much later.

Maybe longterm we should cook up a simsys_android.cc like the window gdi one, we just need screen copy and passing event down and could remove most Android defines in the code. With the current advances with AI coding, a kind of translation should become feasible, hopefully.

Mishasama

Quote from: prissi on September 19, 2026, 10:51:48 PMWith the current advances with AI coding, a kind of translation should become feasible, hopefully.
I've heard that the most reliable code writing AI right now is CLAUDE, and they offer free access to open-source projects. Maybe you could give it a try.
Because of some reason. I am looking for volunteers who can help me update the Pak64.Nightly.

I'm helping to build the Chinese community for now.
如果您是使用中文的玩家,歡迎到這裏尋找同好或張貼您們組織的聯係方式。
如果你是中文玩家,欢迎来这个帖子里找组织或者贴出你们的联系方式。

victor_18993

Thanks for reporting this! The fix is now in r12289.

Long-pressing a text field opens a menu with Copy, Cut, Paste and Select All. It also opens with a right-click on desktop.

The clipboard was already working; what was missing was a way to access these actions by touch.

I've tested it with Gboard on an Android emulator. Could you try a nightly with r12289 or later on your phone? Feedback with Japanese or Chinese input would also help. 🙂
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)

prissi

It works on windows too, but only for the SDL2 version.

victor_18993

#9
Checked SDL3, cheers.
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)

victor_18993

The long-press fix is now in r12293. I had missed the SDL3 touch handling in the original patch — sorry about that!

I've tested the menu and copy/paste on an Android emulator with SDL3.

@prissi, were you using a touchscreen or a mouse? Right-click already worked in my SDL3 tests before this fix, so if that failed for you, I'll investigate it separately.
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)

prissi

I used the touchscreen with the GDI on my laptop (with a touchscreen).

Also, why did you made the edit_menu not a gui_scrolllist? That why all the logic of processing mouse clicks etc is already there. I can convert it, too, it is very quick (mostly removing code). You would send the infowin and drawing event to it first if active. If getroffen is outside the menu, close it.

victor_18993

Thanks for clarifying! I had misunderstood which backend you were testing. Your touchscreen test was with GDI, so the SDL3 fix doesn't cover that case.

You're right about gui_scrolllist — I missed that opportunity to reuse the existing click handling. Please go ahead with the conversion if you'd like, and I'll follow up on the GDI touch handling separately. Thanks for the help!
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)

prissi

Ok, I added the gui_scrolled_list_t. So also the nickname on the online form required opening to the top.