Jump to content
rorix56148

EArgumentOutOfRangeException when Scrolling a TEdit out of View in a TVertScrollBox

Recommended Posts

Hi everyone,

I'm encountering a strange issue in my application and was hoping someone here might have a solution or workaround.
When I scroll a focused TEdit control out of the viewable area within a TVertScrollBox, I get an uncaught EArgumentOutOfRangeException.

Steps to Reproduce:

  1. Create a new FMX application.
  2. Add a TVertScrollBox to the main form.
  3. Add a TEdit control inside the TVertScrollBox.
  4. Make sure the TVertScrollBox is scrollable by adding enough content to enable scrolling.
  5. Focus the TEdit control by clicking on it.
  6. Scroll the focused TEdit control completely out of the viewable area of the TVertScrollBox.

 

Sometimes it takes several scrolling attempts to reproduce the problem but 7 times out of 10 I get this error.
So far I have been able to reproduce the problem on Windows, Android and IOS.

Error Message:

List index out of range (1). TList<FMX.Controls.TControl> range is 0..0

Stacktrace:

'Call Stack Information
[00D18342] FMX.Forms.TCustomForm.PaintRects (Line 6421, "FMX.Forms.pas")
[00CADD26] FMX.Platform.Win.WMPaint (Line 1777, "FMX.Platform.Win.pas")
[00CADDD1] FMX.Platform.Win.WMPaint (Line 1789, "FMX.Platform.Win.pas")
[00CADDF1] FMX.Platform.Win.WMPaint (Line 1795, "FMX.Platform.Win.pas")
[00CADE53] FMX.Platform.Win.WMPaint (Line 1801, "FMX.Platform.Win.pas")
[00CAF2C9] FMX.Platform.Win.WndProc (Line 2353, "FMX.Platform.Win.pas")
[00CB0347] FMX.Platform.Win.WndProc (Line 2804, "FMX.Platform.Win.pas")
[00CB0659] FMX.Platform.Win.WndProc (Line 2890, "FMX.Platform.Win.pas")
[758D93B8] USER32 (possible GetWindowLongW+264)
[00C4FE11] FMX.Platform.Screen.Win.TWinMultiDisplay.PxToDp (Line 440, "FMX.Platform.Screen.Win.pas")
[00CB1E2C] FMX.Platform.Win.TPlatformWin.ClientToScreen (Line 3597, "FMX.Platform.Win.pas")
[758D9331] USER32.GetWindowLongW
[00D107C9] FMX.Forms.TCommonCustomForm.ClientToScreen (Line 4863, "FMX.Forms.pas")
[7759AF04] ntdll.RtlRestoreLastWin32Error
[6E2D9E7B] uxtheme (possible GetThemeBackgroundRegion+6027)
[6E2E00EC] uxtheme (possible GetThemePartSize+9084)
[758E1B49] USER32 (possible AddClipboardFormatListener+73)
[758D7F65] USER32 (possible GetClassLongW+1973)
[758D7D78] USER32 (possible GetClassLongW+1480)
[758D81A9] USER32 (possible GetClassLongW+2553)
[758D7B55] USER32 (possible GetClassLongW+933)
[758DC05D] USER32 (possible CallNextHookEx+413)
[775B54EB] ntdll (possible KiUserCallbackDispatcher+75)
[758D69C3] USER32 (possible DispatchMessageW+1571)
[00629CF4] System.TMonitor.CheckOwningThread (Line 19915, "System.pas")
[758DC269] USER32.PeekMessageW
[758D63AB] USER32.DispatchMessageW
[00CABA41] FMX.Platform.Win.TPlatformWin.HandleMessage (Line 846, "FMX.Platform.Win.pas")
[00D07BFE] FMX.Forms.TApplication.HandleMessage (Line 1940, "FMX.Forms.pas")
[00D07C28] FMX.Forms.TApplication.HandleMessage (Line 1943, "FMX.Forms.pas")
[00CAB802] FMX.Platform.Win.TPlatformWin.Run (Line 750, "FMX.Platform.Win.pas")
[00D088CC] FMX.Forms.TApplication.Run (Line 2268, "FMX.Forms.pas")
[00D088E5] FMX.Forms.TApplication.Run (Line 2269, "FMX.Forms.pas")

 

Has anyone else experienced this issue or does anyone have any suggestions on how to fix it? Any help would be greatly appreciated!

Thanks in advance!

Share this post


Link to post
1 hour ago, rorix56148 said:

Has anyone else experienced this issue

I tried reproducing it using your steps, and was unable to. What version of Delphi?

Share this post


Link to post
On 7/10/2024 at 2:16 AM, Dave Nottage said:

I tried reproducing it using your steps, and was unable to. What version of Delphi?

I have the same issue since about 3 weeks ago in one of my apps:

List index out of bounds (3)

TList<FMX.Controls.TControl> range is 0..2

 

I have a Tabcontrol, with 3 tabs.

1 tab has a VertScrollbox.

I dynamically create 24 group boxes,  each with either 1 edit, and 1 text or 2 of each in it. Groupboxes are aligned to the top

All children of group boxes are aligned to the top.

Running on windows, no error.

 

Run on Android,  the error occurs every time an edit had focus (Cursor in the edit, keyboard displaying), but the scroll works fine after that selected

edit has gone off screen, either top or bottom.  Happens the first time, meaning if I scroll up and get the error, I scroll down passing the top, no error.

if I tap outside of the edit, no error, ever.

 

It just started last week with this little utility I am putting together for a friend.

I can't debug it because I can't find where the error is originating, IE-Groupbox,Scrollbox, etc., since it is a generic tcontrol error.  Like somewhere a count was not set to the right number of controls.

 

Delphi 12 Version 29.0.51961.7529 

 

Share this post


Link to post
On 7/10/2024 at 2:16 AM, Dave Nottage said:

I tried reproducing it using your steps, and was unable to. What version of Delphi?

After a bit more looking into it, It occurs for me on android when I have a tabcontrol, within a tabcontrols Item

Tabcontrol

   L Item1

   L Item2

         L Tabcontrol2

                  L Item1

                       L Vertscrollbox

 

Add a few group boxes, enough to scroll

Add 2 edits to the top group box,

Tap into it then scroll.

Share this post


Link to post
8 hours ago, ToddFrankson said:

After a bit more looking into it, It occurs for me on android...

Using the arrangement you described, I am still unable to reproduce this..

On 7/12/2024 at 6:42 AM, ToddFrankson said:

Delphi 12 Version 29.0.51961.7529 

..using the same version of Delphi.

Share this post


Link to post
17 hours ago, Dave Nottage said:

Using the arrangement you described, I am still unable to reproduce this..

..using the same version of Delphi.

Interesting.  Let me post my Sample project.  see if that does it.  I used android 32 on a Motorola Edge (2020) and a Samsung Galaxy S22 64 bit.  Haven't tried IOS yet.

I have a screen recording, but the file is to large to post here.

test.deployproj

test.dpr

test.dproj

test.dproj.local

test.dsk

test.identcache

test.res

Unit1.fmx

Unit1.pas

Share this post


Link to post
3 hours ago, ToddFrankson said:

Let me post my Sample project.  see if that does it.

Now I can reproduce the problem. Might be to do with the number of controls and/or alignments. I suggested reporting the bug.

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

×