就是如何判断在dbgrid中的ontitleclick事件中点击的是那个column?
解决方案 »
- delphi dll注入进程 如何创建子窗口
- 我在到delphi 中打开execl到表,出错了,帮看看
- 这样为什么会出错?
- @@为什么我的程序在关闭delphi的时候出错:Access violation at address 0083B551 in module ‘VCL70.BPL’.Read of address FFFFFFFF.
- 打开一个应用程序,怎样判断打开了那些窗口,
- 问题 关于串口通信方面的程序
- 不同局域网内的用户建立UDP连接 (测试手记)
- 如何获取一个目录里的所有子目录名称???
- 關於界面問題----郁悶!!!!啊!!!!---有同樣問題的人頂一下
- 退出系统的提示框不安全?
- 请问一个引用DLL时,DLL不存在,而造成错误的问题?
- 触发器与存储过程?
var
iFieldCount:Integer;
TmpSQL:String;
begin
for iFieldCount := 0 to CustomersDBGrid.Columns.Count - 1 do
begin
if (Copy(CustomersDBGrid.Columns[iFieldCount].Title.Caption,Length(CustomersDBGrid.Columns[iFieldCount].Title.Caption)-1,2) = '¨‹') or (Copy(CustomersDBGrid.Columns[iFieldCount].Title.Caption,Length(CustomersDBGrid.Columns[iFieldCount].Title.Caption)-1,2) = '¡ø') then
begin
CustomersDBGrid.Columns[iFieldCount].Title.Caption := Copy(CustomersDBGrid.Columns[iFieldCount].Title.Caption,1,Length(CustomersDBGrid.Columns[iFieldCount].Title.Caption)-3);
break;
end;
end;
if Column.FieldName = FSortField then
begin
if FSort = 'DESC' then
FSort := 'ASC'
else
FSort := 'DESC';
end
else begin
FSortField := Column.FieldName;
FSort := 'ASC';
end;
if FSort = 'ASC' then
Column.Title.Caption := Column.Title.Caption + ' ¡ø'
else
Column.Title.Caption := Column.Title.Caption + ' ¨‹';
try
With DMStoreManage do
begin
qrCustomers.Close;
qrCustomers.SQL.Clear;
TmpSQL:=CustSQL+' order by '+FSortField+' '+FSort;
qrCustomers.SQL.Add(TmpSQL);
qrCustomers.Open;
end;
except end;
var ifieldcount:integer;
begin
for iFieldCount := 0 to DBGrid1.Columns.Count - 1 do
begin
if (Copy(DBGrid1.Columns[iFieldCount].Title.Caption,Length(DBGrid1.Columns[iFieldCount].Title.Caption)-1,2) = '▼') or (Copy(DBGrid1.Columns[iFieldCount].Title.Caption,Length(DBGrid1.Columns[iFieldCount].Title.Caption)-1,2) = '▲') then
begin
DBGrid1.Columns[iFieldCount].Title.Caption := Copy(DBGrid1.Columns[iFieldCount].Title.Caption,1,Length(DBGrid1.Columns[iFieldCount].Title.Caption)-3);
break;
end;
end;
if Column.FieldName = FSortField then
begin
if FSort = 'DESC' then
FSort := 'ASC'
else
FSort := 'DESC';
end
else begin
FSortField := Column.FieldName;
FSort := 'ASC';
end;
if FSort = 'ASC' then
Column.Title.Caption := Column.Title.Caption + ' ▲'
else
Column.Title.Caption := Column.Title.Caption + ' ▼';
adoquery1.Sort := Column.FieldName + ' ' + FSort;
end;
在ontitileclick中有一个参数是Column,利用它可以解决关于哪一列的问题。
如 adotable.sort:=column.title.caption+ ' ASC';感谢大家的回复!