ListView排序的疑点
ListView排序的疑问Delphi(Pascal) codeListView1.CustomSort(sortpro:PFNLVCOMPARElParam:Integer)第一
ListView排序的疑问
Delphi(Pascal) codeListView1.CustomSort(sortpro:PFNLVCOMPARE;lParam:Integer);
第一个参数的类型是什么?
在使用第一个参数的时候,把function定义在窗体中,调用这个方法的时候会提示错误,但是如果把function单独定义,则可以通过,请问这2种定义有何区别?
[解决办法]看它的定义:
PFNLVCOMPARE = function(lParam1, lParam2, lParamSort: Integer): Integer stdcall;
不能定义到类成员中,要定义为全局函数
因为是stdcall,而不是of object
注意区分
[解决办法]Delphi(Pascal) codefunction CustomSortProc(Item1, Item2: TListItem; ParamSort: integer): integer; stdcall; procedure TForm1.ListView1ColumnClick(Sender: TObject; Column: TListColumn); begin ListView1.CustomSort(@CustomSortProc, Column.Index); end;