* * *

Author Topic: How to avoid 'position range overflow' when filling a TScrollBox or TflowPanel  (Read 1574 times)

Fish

  • New member
  • *
  • Posts: 11
Even in your button click event, your trying to create panels that top value exceeds the limits of smallint.

Yes, but that's what this thread is all about.

Quote
I appreciate this does not solve your problem, but it shows what is causing your design to fail.

Not really. What I wanted to show with this demo is that I'm able to add panels whose top values exceed the limits of smallint without any problems. I can select them, I can change their color or caption and I can even read their top values. Everything is fine, as if there is no 15 (or 16) bit limitation. Problems arise only if I want to change their position subsequently.
But, okay, seems as if I have to live with that.

Fish

  • New member
  • *
  • Posts: 11
yes you are obviously over doing the client scrolling area..
Yes, intentionally. See above post.

Quote
The best solution and most practiced is to use a DrawGrid or in your case since you are
already miles deep into your methods of coding is to limit the actual number of panels made.

Seems to be the only way, sigh. I don't like the fact, that you quite likely won't be able to scroll up and down fast and smooth, e.g. to search or compare pictures. I'll check it out.

Quote
   its all about design.. I suppose the limit could be fixed if the issues for the reason the limit was put there in the first place are corrected.
Well the reason seems to be Windows (as always). Maybe dating back to the times where first class computer monitors showed a resolution of 640x480 and 640K ought to be enough for anybody.
I've heard the rumors that some producers will introduce so called 4k monitors within the next years. ;)

Thanks
Chris   

josh

  • Sr. Member
  • ****
  • Posts: 484
Quote
Not really. What I wanted to show with this demo is that I'm able to add panels whose top values exceed the limits of smallint without any problems.

When I run your example using trunk, I get an error when creating panels exceeding the smallint limit. Hense why I added in the check before the panel is created.

AFAIR screen x and y ordinates of components and even the mouse on windows are stored in 4 bytes ( 2 bytes for each ordinate), which is the windows limitation.
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

Fish

  • New member
  • *
  • Posts: 11
Quote
When I run your example using trunk, I get an error when creating panels exceeding the smallint limit. Hense why I added in the check before the panel is created.

I don't, as shown in the screenshots. Maybe because I'm running it on Linux (?)

jamie

  • Sr. Member
  • ****
  • Posts: 426
its possible limited to the LCL maybe, checking the SetwindowPos shows me it is using INT, which for 32
bit system should be vary large.
I do know the WM_VSCROLL is limited to a WORD and should range to 0..65535 so I don't know exactly what is
happening here much be a limit in the LCL set.


taazz

  • Hero Member
  • *****
  • Posts: 4750
if positioning it at the bottom gives you so much trouble then do it backwards. Create the objects from last to first and set their top property to 0 or -1 before setting the align to altop that should push the rest of the frames down placing the last added frame on top. Just make sure you have the window locked for refresh before adding the frames to speed things up.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Fish

  • New member
  • *
  • Posts: 11
If I set the align to alTop I get the overflow error whether forwards or backwards. Even the previously working example (for me under Linux) crashes if I add the alignment.

I guess we (or I) have to realize that there's no way out of this limited conditions and close this thread. I will have a look on the alternative suggestions, which may raise other problems and questions (I promise I will bother you again)

Thanks guys for all your help and contributions
Chris   

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus