I got a whole Delphi application with 32 differents forms for data input. I got 1 main TCategoryPanelGroup with 115 diffrents TCategoryPanel on it.
There are 6 main TCategoryPanel (main1, to main6) that we found on each forms and we add to this some specific (specific1, 2, 3, and so on) TCategoryPanel to each of them.
All forms are already prebuilt in the application, theren't built at runtime.
There's the way I do manage those forms (32 forms with an average of 10 panels of information on each)
Than the user may open another different form (from 32) and the same process goes again. But somehow, the order of panels aren't always the same that I do show (visible true) them.
Sometimes, specific1 panel comes right before main1 or even after main6. First form to get open always fine, and after opening and closing different forms, all panel orders are all mixed up.
I spent a couple of time looking on the web trying to understand the way TCategoryPanelGroup manage the order of his panels while showing and hidding them and there ya go, I Need help.
Well, the question is simple, is there different way to manage panels order on a TCategoryPanelGroup to suits my needs? Can we simply make them visible than after all rearrange the order?
So far, I focus on those 2 links for something similar but unable to get trought :
http://www.devsuperpage.com/search/Articles.aspx?G=2&ArtID=92075 http://codeverge.com/embarcadero.delphi.vcl.using/order-of-tcategorypanels-on-tcat/1066818
My MCVE
Nb of specific panels :
TEST A :
TEST B :
2 different overall situations : specific panels not regrouped and specific panels order are mixed up. I do understand what's going on before even opening form one after another but can't found out a way to fix it.
Allright, got it by myself
The TCategoryPanelGroup manage the order of his TCategoryPanel with the TOP property.
hidding (visible : false) them in reverse order and Showing (visible := true) them in order could work if you always have the same amount of panels to show in the same order.
I found this post related to the TOP property that inspire's me : How to reorder categories in TCategoryPanelGroup (Delphi XE). In this post the solution is to give the exact TOP value from 0 for the first panel, the second one is equal to the height value of the first panel and so on.
I figured something a lot easier by giving all panel the same TOP value before showing them... be careful, to provent panel disorder, you need to give a TOP value greater than the longest form you could have in the TCategoryPanelGroup with panels COLLAPSED to false.
So on hiding all panels no matter the exact order and giving them TOP value := 10000 to each all is now fixed.
RECAP :
That's it we're done!
My MCVE with the solution included download it here