Jump to content
Magno

Is TEdit bugged with mobile? Since when?

Recommended Posts

I am using Delphi 10.4.2 CE, also downloaded the trial version of Alexandria and the results are the same:

 

1. Put a TEdit into the form, aligned or not, target to mobile

2. Type in some words until you cross the visible borders, so the text will scroll...

3. Try returning to the beginning of the text! 

 

If you can do it without get blocked into the visible part of the control, please let me know how to! I can't move the cursor beyond the visual limits.

 

If you change to Platform mode it will work as it should, but you will lose the Z level for the controls.

 

InkedScreenshot_20220328-165934_LI.jpg

Share this post


Link to post

Are you referring to the lack of left/right/home/end buttons, or just the standard user interface on a mobile device? 

 

I've never had problems with TEdit text scrolling on mobile devices--I just hook up a Bluetooth keyboard if I want to be able to move the cursor through the text.

Share this post


Link to post
2 hours ago, corneliusdavid said:

Are you referring to the lack of left/right/home/end buttons, or just the standard user interface on a mobile device? 

 

I've never had problems with TEdit text scrolling on mobile devices--I just hook up a Bluetooth keyboard if I want to be able to move the cursor through the text.

I don't know about lack of buttons, but I meant about the inability to move the cursor/caret allowing the user to edit any text he already typed in. You can only fix the text you "see" in the control at that time.

 

Suppose the user need to type "Lorem ipsum dolor sit amet, consectetur adipiscing elit":

 

Lorem ipsum |dolor sit amet, consectetur adip|iscing elit

 

The green text between the two pipes | represents the width of the TEdit. So if the cursor is over the letter r and the user needs to fix a test beyond this space it's impossible, unless he deletes the text using backspace, the gray text is out of range because there is no visible cursor to allow moving to that text.

 

Edited by Magno

Share this post


Link to post

Right. That's typical on a mobile device--it's not specific to Delphi apps. Basically, you can type forward or backspace to clear it out and type it over. That's why I sometimes hook a Bluetooth keyboard up to my mobile device when I'm writing lots of text--I can use the keyboard arrow keys to navigate past the beginning/end of the visible text.

 

Have you ever sent a long text message with a phone? It's a pain if you've been typing fast then look at what you've typed and realized there's a misspelled word in the middle and you have to somehow select it and type over without losing it or finger-swipe to go back to the top of the paragraph to make sure you didn't miss anything.

 

You could set the MaxLength property of the TEdit so the user can't type a bunch of text; or use a TMemo and make it fill up the screen so the user can see all the text they've typed.

 

Welcome to mobile development!!

Share this post


Link to post

On Android, you should be able to move the caret to the right by tapping and dragging?

Share this post


Link to post
7 hours ago, corneliusdavid said:

Right. That's typical on a mobile device--it's not specific to Delphi apps.

That does not sound typical at all.

 

I don't know about Android, but on iOS you can either scroll by swiping on the space key, or by tap and holding within the text area. It is not a problem at all.

  • Like 1

Share this post


Link to post
14 hours ago, Der schöne Günther said:

I don't know about Android, but on iOS you can either scroll by swiping on the space key, or by tap and holding within the text area. It is not a problem at all.

Have you tried other apps on Android that have a small text edit input to compare how they act? @Lars Fosdaldescribes how it can be done on Android--and yes, that works but I have problems getting it right so more often just backspace or don't even try to scroll. Same thing on iOS.

Share this post


Link to post
On 3/28/2022 at 9:18 PM, corneliusdavid said:

Right. That's typical on a mobile device--it's not specific to Delphi apps. Basically, you can type forward or backspace to clear it out and type it over. That's why I sometimes hook a Bluetooth keyboard up to my mobile device when I'm writing lots of text--I can use the keyboard arrow keys to navigate past the beginning/end of the visible text.

 

Have you ever sent a long text message with a phone? It's a pain if you've been typing fast then look at what you've typed and realized there's a misspelled word in the middle and you have to somehow select it and type over without losing it or finger-swipe to go back to the top of the paragraph to make sure you didn't miss anything.

 

You could set the MaxLength property of the TEdit so the user can't type a bunch of text; or use a TMemo and make it fill up the screen so the user can see all the text they've typed.

 

Welcome to mobile development!!

Well I agree but in this case it will work fine when changing the Style to Platform, so this can be a very specific issue with FMX.

 

Share this post


Link to post
On 3/29/2022 at 1:32 AM, Lars Fosdal said:

On Android, you should be able to move the caret to the right by tapping and dragging?

Not working, you got trapped into the visible text. Want to change a word/letter beyond the visible part? Delete back some characters... 

Share this post


Link to post
14 hours ago, corneliusdavid said:

Have you tried other apps on Android that have a small text edit input to compare how they act? @Lars Fosdaldescribes how it can be done on Android--and yes, that works but I have problems getting it right so more often just backspace or don't even try to scroll. Same thing on iOS.

do you have any technical explanation for that or are you telling stories here?

Edited by Attila Kovacs

Share this post


Link to post
14 hours ago, corneliusdavid said:

Have you tried other apps on Android that have a small text edit input to compare how they act? @Lars Fosdaldescribes how it can be done on Android--and yes, that works but I have problems getting it right so more often just backspace or don't even try to scroll. Same thing on iOS.

Normally other apps would use different frameworks from FMX. This very app I am creating, as I already told, will work when changing the ControlStyle to Platform, but if I do it one of the issues is related to z control, like bellow:

 

Screenshot_20220330-092905.jpg

Share this post


Link to post

OK, I finally see what you're getting at. I got sidetracked by just the idea of simple editing of text on a mobile device and missed part about the ControlType--sorry. (I had recently experienced frustration when typing a long text and trying to view/edit the whole thing--and that was using the phone's built-in text messaging app--I thought that's where this was going.)

 

I ran a sample project and switched the ControlType property of the TEdit between Styled and Platform and now see what you've been trying to explain. Yes, the "Platform" control works properly but (and as explained on docwiki) does not respect the z-order. 

 

So, yeah, it does look like a bug, or incomplete feature implementation, in the styled version of the TEdit.

  • Like 1

Share this post


Link to post
On 3/30/2022 at 1:03 PM, corneliusdavid said:

OK, I finally see what you're getting at. I got sidetracked by just the idea of simple editing of text on a mobile device and missed part about the ControlType--sorry. (I had recently experienced frustration when typing a long text and trying to view/edit the whole thing--and that was using the phone's built-in text messaging app--I thought that's where this was going.)

 

I ran a sample project and switched the ControlType property of the TEdit between Styled and Platform and now see what you've been trying to explain. Yes, the "Platform" control works properly but (and as explained on docwiki) does not respect the z-order. 

 

So, yeah, it does look like a bug, or incomplete feature implementation, in the styled version of the TEdit.

Nice! That's exactly the issue. So when user enter the edit I change to Platform, he lefts I change back to Platform, as a workaround.

Share this post


Link to post
Posted (edited)
On 4/1/2022 at 1:20 PM, Magno said:

Nice! That's exactly the issue. So when user enter the edit I change to Platform, he lefts I change back to Platform, as a workaround.

Can you share a working sample of code? I get an access violation error when I try to do something like this (OnEnter event)   =>

   

edit1.Visible := false;
    edit1.BeginUpdate;
    edit1.ControlType := TPresentedControl.TControlType.Platform;
    edit1.EndUpdate;
    edit1.Visible := true;

The error occurs on line 997 of the FMX.Edit.Style.New unit:

 

error.thumb.jpg.ab25ee328dcd29cf28293da582107a48.jpg

 

As a temporary working solution, for edit1 in the Object Inspector, I set ControlType = Styled, activated Touch => Gestures => Standard = [Left, Right], and wrote the following OnGesture event handler:

 

if EventInfo.GestureID = sgiLeft then
  (Sender as TEdit).SelStart := (Sender as TEdit).SelStart + 3
else if EventInfo.GestureID = sgiRight then
  (Sender as TEdit).SelStart := (Sender as TEdit).SelStart - 3; 
Handled := True;

 

Edited by apachx

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×