Why AddGantt or AddGanttColor returns the same index for different invocations?

二次信任 提交于 2019-12-12 04:24:47

问题


For some reason for certain cases when adding gantts to a TGanttSeries instance using method AddGanttColor or AddGantt the same index is returned for two different calls.

For example, the following snippet illustrates the case where the last two calls both return index of value 1.

Series.AddGanttColor(0, 100, 0, 'WA #234', clGreen);   // returns value 0
Series.AddGanttColor(100, 200, 1, 'WA #235', clGreen); // returns value 1 
Series.AddGanttColor(50, 200, 2, 'WA #237', clGreen);  // returns value 1!

However, all three gantts are displayed. So, it seems that the third line added gantt as the second in the list, and moved the gantt added on the second line to be the last one (third, and having index 2).

Could anyone please explain how could this be remedied to ensure that returned indexes stay associated with gantts as per AddGanttColor calls. In the above example, I would expect index values 0, 1, and 2 to be associated with the first, second and third added gantt respectively.


Have just confirmed that this situation holds true for TeeChart versions 5 and 8 running under Delphi 5.


回答1:


Well... after some research the cause of the problem was narrowed down to the value of property Series.XValues.Order. This property should be set to loNone in order to preserve association between index values returned from AddGantt and corresponding gantts.

IMO this is an API deficiency.



来源:https://stackoverflow.com/questions/16815664/why-addgantt-or-addganttcolor-returns-the-same-index-for-different-invocations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!