Solved

TVirtualStringTree in TScrollBox at pos greater than 32767

Posted on 2014-01-17
12
476 Views
Last Modified: 2014-01-25
Hi

I have a ScrollBox and I populate it with lot's of TLables and TVirtualStringTrees... I create  a long report with heading (TLabel) and data grid (TVirtualStringTree)  and it works fine. By default I have 10+ reports and show the ones that have any data. So, sometimes I show all of them, sometimes just 1 or 2 (each has label/name of report and virtual tree for data).
So, they are all already in the scroll box, I just hide/show the ones I need.

The problem is that in very rare cases the first few reports have a couple of thousand lines/nodes, so the scroll box can quickly get to 50.000 in height. The problem is, that virtual trees don't go after 32767 point! Meaning all treeviews that should be located on positions 32767+ get stuck on that position, but all the labels get positioned to a proper pos in scroll box, 50.000, 100.000+.

I searched around and found that TScrollBox used to have a problem with not extending beyond 32767, due to some Windows limitation. Either this was true in earlier Delphi version, I use D2006, because TLabel has no problem being position beyond 32767 position mark.

So, is it a limitation of ScrollBox that affects TVirtualStringTree or is it TVirtualStringTree limitation? Any suggestions how to overcome it?

You can test with simple, TScrollBox and put TLabel and TVirtualStringTree inside. Then set:
Label1.Top := 35.000;
VirtualStringTree1 .Top := 35.020;

Open in new window

and it won't work, tree view will be shown higher than label.

As said, this happens in rare occasions, but it does, so I don't want to change the whole logic of how the scroll box works (I found some suggestions to trick the user with how the visible area of scroll box is presented to show the controls correctly as though they appear below 32767 mark, bu they are actually juts near the top - this is not what I want to do).

Thank you
0
Comment
Question by:Delphi_developer
  • 6
  • 6
12 Comments
 
LVL 19

Expert Comment

by:MerijnB
ID: 39789938
If it's it just TVirtualTree which won't go lower then 32767, as a workaround put a TPanel for each TVirtualTree in the TScrollBox, and put the virtual trees in the panels?
0
 

Author Comment

by:Delphi_developer
ID: 39790335
Thank you for suggestion,  but it doesn't seem to work, it's Top is also set to 32767 and not beyond.

Any other suggestions?
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 39790531
Are there any components which can be set further then 32767?
0
 

Author Comment

by:Delphi_developer
ID: 39790536
Yes, TLabel works OK and can be positioned beyond 100.000 pos, it seems like the only one. TEdit and TButton don't go beyond that point, either.
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 39790596
TLabel does not have a handle, while TEdit and TButton do (TLabel inherits from TGraphicControl and not TWinControl). All nice, but this doesn't help you with your problem.

It seems this is a limitation in SetWindowPos() the Windows API Delphi uses to position the controls. So I'm afraid that even if someone can think of a work around, it will probably mean that it will mean you can't use Delphi in the 'normal' way, will bring some hassle.

Let's see if we can tackle this the other way round, can you split the reports up some way, so you won't get past 32767 pixels?
0
 

Author Comment

by:Delphi_developer
ID: 39790656
No, can't split them. It happens as soon as I have 3 reports with 1000 records. It's rare, but it does happen. I only noticed this when testing for limits, memory consumption... was testing much larger situations, where it could get to 300.000 pixels... and noticed this 32767 limit.

It's just before release date, so I'm looking for a fix, that does not require 2-4 weeks dev time (dev, test, sign off, beta...). I was looking for a replacement component, but so far nothing, there are wrappers around TScrollBox, meaning they have the same limitation.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 19

Assisted Solution

by:MerijnB
MerijnB earned 100 total points
ID: 39793542
Since the problem isn't in Delphi but in the Windows API, you will probably not be able to work around this from Delphi perspective I'm afraid.

Maybe you can cheat by hiding parts of the report which are currently not in view or something?
0
 

Accepted Solution

by:
Delphi_developer earned 0 total points
ID: 39793819
OK, thank you, I appreciate your effort. I will look into different way to go.
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 39793842
Maybe you can give this a shot. Put panels in your scrollbox, but don't position them manually, just set all their align's to alClient. What I see here is that there tops are still stuck to 32767, but visually it seems ok.

Place your controls within the panels, as long as the panels themselves don't get larger then 32767 you might have something working.
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 39793847
Previous comment has typo, align = alTop, not alClient!

Or you could even try not using panels at all, don't set the tops of the controls, just use align = alTop only.
0
 

Author Comment

by:Delphi_developer
ID: 39793875
I tried alTop already, at the beginning, but hiding/showing controls and letting Delphi handle and align properly, was never working good. The order was not always correct and sometimes the controls just didn't align alTop, before repainting, resizing the ScollBox - just didn't work good. Manually aligning them works every time.
But even with alTop, when the length of controls pass 32767 mark, it doesn't work - they get positioned on the same mark.

Thanks, but I'm not using panels, anyway.
0
 

Author Closing Comment

by:Delphi_developer
ID: 39808394
No solution provided.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now