我的排序代码是这样的
windowsxpform.XPTree.Header.SortColumn:=1;
windowsxpform.XPTree.Header.SortDirection:=sdDescending;
windowsxpform.XPTree.SortTree(1,sdDescending,false);组件的compare事件已经写好了,测试也是没问题的。
就是排序不行,一排序就是内存访问错误官方demo的排序是这样的
procedure TWindowsXPForm.XPTreeHeaderClick(Sender: TVTHeader; Column: TColumnIndex; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);begin
if Button = mbLeft then
begin
with Sender, Treeview do
begin
if SortColumn > NoColumn then
Columns[SortColumn].Options := Columns[SortColumn].Options + [coParentColor]; // Do not sort the last column, it contains nothing to sort.
if Column = 2 then
//SortColumn := NoColumn
else
begin
if (SortColumn = NoColumn) or (SortColumn <> Column) then
begin
SortColumn := Column;
SortDirection := sdAscending;
end
else
if SortDirection = sdAscending then
SortDirection := sdDescending
else
SortDirection := sdAscending; Columns[SortColumn].Color := $F7F7F7;
SortTree(sortcolumn, SortDirection, true);
end;
end;
end;
end;把官方的demo的排序换成我那个也不行,郁闷,有人知道怎么回事么?谢
windowsxpform.XPTree.Header.SortColumn:=1;
windowsxpform.XPTree.Header.SortDirection:=sdDescending;
windowsxpform.XPTree.SortTree(1,sdDescending,false);组件的compare事件已经写好了,测试也是没问题的。
就是排序不行,一排序就是内存访问错误官方demo的排序是这样的
procedure TWindowsXPForm.XPTreeHeaderClick(Sender: TVTHeader; Column: TColumnIndex; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);begin
if Button = mbLeft then
begin
with Sender, Treeview do
begin
if SortColumn > NoColumn then
Columns[SortColumn].Options := Columns[SortColumn].Options + [coParentColor]; // Do not sort the last column, it contains nothing to sort.
if Column = 2 then
//SortColumn := NoColumn
else
begin
if (SortColumn = NoColumn) or (SortColumn <> Column) then
begin
SortColumn := Column;
SortDirection := sdAscending;
end
else
if SortDirection = sdAscending then
SortDirection := sdDescending
else
SortDirection := sdAscending; Columns[SortColumn].Color := $F7F7F7;
SortTree(sortcolumn, SortDirection, true);
end;
end;
end;
end;把官方的demo的排序换成我那个也不行,郁闷,有人知道怎么回事么?谢
解决方案 »
- 怎样 解压 zip 和 rar 文件,谢谢
- 请教!!!如何在delphi中调用WebService????
- 那里有最新的installshield安装程序,做的安装盘要中文界面的,谢谢??????????????????
- 请教
- 初学fastreport报表的朋友,请来www.haxh.com,这里有详细安装方法、使用说明、示例等!
- 开了一贴未解,重开:SQL语句(左连接、内连接)
- Borland Delphi 7 Studio Enterprise 注册码,序列号
- 200,再线等待,我的控件为什么编译出错???
- 有广州的程序员在吗?这份合同到底能不能签!在线等待
- DELPHI的帮助?
- 请问OnClick事件是在哪个类里公布的呢?
- 进来看下图片效果,看该如何做??
用
XPTree.Header.SortColumn:=1;
XPTree.Header.SortDirection:=sdDescending;
XPTree.SortTree(1,sdDescending,false);
就没问题,但编译时没错误提示