生活記錄


 
最后修改: June 19 2007 00:36:31
文件: N/A - 2007-06-19_01.19AM.html
大小: 0.76KB
標題:Delphi 動態數組

I was stuck the whole afternoon in debugging... finally i found something interesting...

Every time Delphi's Dynamic Array , (setLength fun) is extended, the original array cells' addresses may be changed...

Because I use TTreeView to link its Data (Pointer) to a particular cell of a dynamic array.

e.g.

TreeView.Data:=@dynamic_array[i];

and

unfortunately, the program adds one cell to dynamic_array somewhere...

setLength(dynamic_array,length(dynamic_array)+1);

the original cells' address are totally different, which is really confusing....

anyway, i solved this by taking the alternative...

TreeView.Data:=Pointer(i);

when i use it, i go for something like this..

dynamic_array[integer(TreeView.Data)];

Haha, everything works out finally.


評論 (0)


當前頁暫時沒有評論。


  Google `Zhihua Lai`   Hosted On Fasthosts Locations of visitors to this page

最后更新: September 01 2010 15:02:49