TCategoryPanel进入TCategoryPanelGroup的命令 [英] Order of TCategoryPanel into TCategoryPanelGroup

查看:91
本文介绍了TCategoryPanel进入TCategoryPanelGroup的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个完整的Delphi应用程序,其中包含32种不同形式的数据输入。我有1个主要的TCategoryPanelGroup,上面有115个不同的TCategoryPanel。

I got a whole Delphi application with 32 differents forms for data input. I got 1 main TCategoryPanelGroup with 115 diffrents TCategoryPanel on it.

我们在每种表单上都找到6个主要的TCategoryPanel(main1至main6),并在其中添加了一些特定的(specific1、2、3,依此类推)

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.

我有办法管理这些表单(32个表单,每个表单平均包含10个信息面板)

There's the way I do manage those forms (32 forms with an average of 10 panels of information on each)


  • 在运行应用程序之前,所有面板均显示为false且顺序正确;

  • 用户选择了32种形式之一;

  • 我确实显示(可见为真)那些面板依次为:
    main1,main2,main3,specific1,specific2,main4,main5和main6;

  • 我向用户显示表单;

  • 在关闭表单时,我按以下顺序隐藏(可见的false):main6,main5,main4,特定2,特定1,main3,main2和main1;

  • Before running the application, all panels are visible false and all ordered correctly;
  • the user chose one of the 32 forms;
  • I do show (visible true) those panels in order : main1, main2, main3, specific1, specific2, main4, main5 and main6;
  • Than I show the form to the user;
  • On closing the form, I do hide (visible false) in order : main6, main5, main4, specific 2, specific 1, main3, main2 and main1;

比用户可以打开另一个不同的表单(来自32)和相同的pr再次发生。但是,不知何故,面板的顺序并不总是与我显示的顺序相同(可见)。

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.

有时,specific1面板在main1之前,甚至在main6之后。
第一个打开的表格总是很好,打开和关闭不同的表格后,所有面板订单都混在一起了。

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.

我花了一些时间看在网络上试图了解TCategoryPanelGroup在显示和隐藏面板时管理面板顺序的方式,我需要帮助。

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.

问题很简单,是否有其他方法可以在TCategoryPanelGroup上管理面板订单以适合我的需求?

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


我的MCVE

My MCVE

在此处下载

特定面板的Nb:


  • 表格#1 = 4

  • 表格#2 = 2

  • 表格# 3 = 3

  • 表格#4 = 2

  • Form #1 = 4
  • Form #2 = 2
  • Form #3 = 3
  • form #4 = 2

测试A:


  1. 打开表格#1 {好}
  2. 关闭它

  3. 打开表格#3 {okay}

  4. 关闭它

  5. 打开#1表单{不行,因为从特定面板的最低nb起还有1个面板尚未打开}

  6. 关闭它

  7. 打开表格#4 {okay}他现在是特定开放面板中最低的nb,为2。

  8. 关闭它

  9. 打开表格#3 {不好,原因有3个特定的面板,并且到目前为止打开的最低面板为2}

  10. 关闭该应用程序。

  1. Open Form #1 {okay}
  2. Close it
  3. Open Form #3 {okay}
  4. Close it
  5. Open Form #1 {not okay, since 1 more panel from the lowest nb of specific panels open yet}
  6. Close it
  7. Open Form #4 {okay} he's now the lowest nb of specific open panels with 2.
  8. Close it
  9. Open Form #3 {not okay, cause got 3 specific panels and the lowest opened by now was down to 2}
  10. Shut down the application.

测试B:


  1. 打开表格#3 {好}

  2. 关闭它

  3. 打开表格#4 {好的最低nb现在是2}

  4. 关闭它

  5. 打开表格#3 {不好,原因是有3个特定的面板,现在打开的最低面板数降至2}

  6. 关闭它

  7. 打开表格#2 {好吧,因为我们现在等于特定最低的nb就是2}

  8. 关闭它

  9. 打开表格#3 {不好,原因是有3个特定的p anels,到现在为止最低开盘价降至2。这是另一种情况,因为特定的#2,#6和#4现在混在一起,也没有重新组合}

  10. 关闭

  1. Open Form #3 {okay}
  2. Close it
  3. Open Form #4 {okay lowest nb of specific is now at 2}
  4. Close it
  5. Open Form #3 {not okay, cause got 3 specific panels and the lowest opened by now was down to 2}
  6. Close it
  7. Open Form #2 {okay since we're equal to nb of specific lowest by now which is 2}
  8. Close it
  9. Open Form #3 {not okay, cause got 3 specific panels and the lowest opened by now was down to 2. Here we have another situation since specific #2, #6 and #4 are now mixed up and also not regrouped}
  10. Shut down the application.

2种不同的总体情况:未重新分组的特定面板和特定的面板顺序混合在一起。我什至在打开一个表单之前都知道发生了什么,但找不到解决方法。

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.

推荐答案

好吧,我自己搞定了

TCategoryPanelGroup使用TOP属性管理其TCategoryPanel的顺序。

The TCategoryPanelGroup manage the order of his TCategoryPanel with the TOP property.

以相反的顺序隐藏(可见:false),如果总是显示相同数量的面板,则按顺序显示(visible:= true)可以工作相同的顺序。

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.

我发现此帖子与激发我的TOP属性有关:如何在TCategoryPanelGroup(Delphi XE)中对类别重新排序。在本文中,解决方案是为第一个面板提供从0开始的精确TOP值,第二个面板等于第一个面板的高度值,依此类推。

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.

在给所有面板显示相同的TOP值之前,我发现要容易得多……要小心,以免造成面板混乱,您需要给出TOP值大于您在TCategoryPanelGroup中可以将面板COLLAPSED设置为false的最长形式。

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.

因此,在隐藏所有面板时,无论其确切顺序如何,并为其赋予TOP值:= 10000,现在都已固定。

So on hiding all panels no matter the exact order and giving them TOP value := 10000 to each all is now fixed.

RECAP:


  • 所有面板都是不可见的{无论您使其变为不可见的顺序}。

  • 所有面板的TOP值相同:= 10000; {比最长的表单更大的价值}

  • 按照从顶部到底部必须显示的确切顺序显示面板;

就是这样,我们完成了!

That's it we're done!


我的MCVE包含解决方案在此处下载

这篇关于TCategoryPanel进入TCategoryPanelGroup的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆