>>this code;(error) same, when I scroll my mouse at the dbgrid
procedure TForm1.DBGrid1TitleClick(Column: TColumn);
begin
(Column.Field.DataSet as TSQLQuery).IndexFieldNames:=Column.FieldName;
end;
>>this code;(error) same, when I scroll my mouse at the dbgrid
function TForm1.DBGridToggleSort(AFieldName: String; dsGrid: TSQLQuery): boolean;
var
ix: TIndexDef;
begin
//Reverse column sorting with each click
if dsGrid.IndexFieldNames <> '' then
begin
//Sort Descending
dsGrid.IndexFieldNames := '';
ix := TIndexDef.Create(dsGrid.IndexDefs, AFieldName, AFieldName, [ixDescending]);
dsGrid.IndexName := ix.Name;
end
else
begin
//Sort Ascending
dsGrid.IndexName := '';
dsGrid.IndexFieldNames := AFieldName;
end;
end;
procedure TForm1.DBGridmLeaderTitleClick(Column: TColumn);
var
dsGrid: TSQLQuery;
AFieldName: string;
begin
dsGrid := (Column.Field.DataSet as TSQLQuery);
AFieldName := Column.FieldName;
DBGridToggleSort(AFieldName, dsGrid);
end;
Whats on Lazarus dbgrid mouse scroll? it is the mouse scroll? or somehing else, what?
I am applying master and detail application.
The code:( I know the problem is not on the code below, but something when I scroll the mouse inside dbgrid)
procedure TForm1.FormShow(Sender: TObject);
begin
SQLite3Connection1.Directory := '';
SQLite3Connection1.DatabaseName := 'candid.db';
SQLTransaction1.DataBase := SQLite3Connection1;
SQLTransaction1.Action := caCommit;
SQLTransaction1.Active := True;
SQLite3Connection1.Transaction := SQLTransaction1;
SQLite3Connection1.Connected := True;
SQLQuery1.DataBase := SQLite3Connection1;
SQLQuery1.SQL.Text := 'select * from leaders';
SQLQuery1.Transaction := SQLTransaction1;
Datasource1.DataSet := SQLQuery1;
DbEdit1.DataField := 'LEADER_ALIAS_NAME';
DbEdit2.DataField := 'PRECINCT_NUMBER';
DbMemo1.DataField := 'LEADER_NOTE';
DbEdit1.DataSource := Datasource1;
DbEdit2.DataSource := Datasource1;
DbMemo1.DataSource := Datasource1;
DBGridLeader.DataSource := Datasource1;
DBGridmLeader.DataSource := Datasource1;
DBGridPrint.DataSource := Datasource1;
SQLQuery1.Open;
SQLQuery2.DataBase := SQLite3Connection1;
SQLQuery2.DataSource := Datasource1;
SQLQuery2.Transaction := SQLTransaction1;
SQLQuery2.SQL.Text := 'select MEMBER_NAME from MEMBERS where MEMBER_LEADERS_NAME = :LEADER_ALIAS_NAME';
Datasource2.DataSet := SQLQuery2;
DBGridMember.DataSource := Datasource2;
DBGridPrintMember.DataSource := Datasource2;
SQLQuery2.Open;
SQLQuery3.DataBase := SQLite3Connection1;
SQLQuery3.Transaction := SQLTransaction1;
SQLQuery3.SQL.Text := 'select * from MEMBERS';
Datasource3.DataSet := SQLQuery3;
DBGridmMember.DataSource := Datasource3;
DbEdit3.DataField := 'MEMBER_NAME';
DbEdit4.DataField := 'MEMBER_LEADERS_NAME';
DbMemo2.DataField := 'MEMBER_NOTE';
DbEdit3.DataSource := Datasource3;
DbEdit4.DataSource := Datasource3;
DbMemo2.DataSource := Datasource3;
SQLQuery3.Open;
end;