jahlxx Posted October 5, 2016 Share Posted October 5, 2016 hi. whe a dbgrid is paged, with arrow keys I move to next and / or prior record. with down arrow key, when the cirsor is in nthe last record of one page, how can I do to go to next record (first record of next page? Now the corsor stops in the last record and have to move to next page manually. Thanks. Link to comment Share on other sites More sharing options...
Sherzod Posted October 5, 2016 Share Posted October 5, 2016 Hi, Can you try this approach ?!: For example for "down": procedure TMainForm.UniDBGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if (Key = VK_DOWN)and((Sender as TUniDBGrid).WebOptions.Paged) then begin if ((Sender as TUniDBGrid).DataSource.DataSet.RecNo mod (Sender as TUniDBGrid).WebOptions.PageSize) = 0 then (Sender as TUniDBGrid).DataSource.DataSet.Next end; end; You should also think about the logic of "up"... Best regards. 1 Link to comment Share on other sites More sharing options...
jahlxx Posted October 5, 2016 Author Share Posted October 5, 2016 ok. thanks. Link to comment Share on other sites More sharing options...
jahlxx Posted July 24, 2017 Author Share Posted July 24, 2017 I have this: for up key, this works, but have a extrange behaviour if (Key = VK_UP)and((Sender as TUniDBGrid).WebOptions.Paged) then begin if ((Sender as TUniDBGrid).DataSource.DataSet.RecNo mod (Sender as TUniDBGrid).WebOptions.PageSize) <> 0 then (Sender as TUniDBGrid).DataSource.DataSet.Prior end; And with this don't work: if (Key = VK_UP)and((Sender as TUniDBGrid).WebOptions.Paged) then begin if ((Sender as TUniDBGrid).DataSource.DataSet.RecNo-1 mod (Sender as TUniDBGrid).WebOptions.PageSize) = 0 then (Sender as TUniDBGrid).DataSource.DataSet.Prior end; ?????? Link to comment Share on other sites More sharing options...
Sherzod Posted July 24, 2017 Share Posted July 24, 2017 Hi, Try: if (Key = VK_DOWN)and((Sender as TUniDBGrid).WebOptions.Paged) then begin if ((Sender as TUniDBGrid).DataSource.DataSet.RecNo mod (Sender as TUniDBGrid).WebOptions.PageSize) = 0 then (Sender as TUniDBGrid).DataSource.DataSet.Next end else if (Key = VK_UP)and((Sender as TUniDBGrid).WebOptions.Paged) then begin Caption := IntToStr((Sender as TUniDBGrid).DataSource.DataSet.RecNo); if (((Sender as TUniDBGrid).DataSource.DataSet.RecNo-1) mod (Sender as TUniDBGrid).WebOptions.PageSize) = 0 then (Sender as TUniDBGrid).DataSource.DataSet.Prior end; Best regards, Link to comment Share on other sites More sharing options...
jahlxx Posted July 24, 2017 Author Share Posted July 24, 2017 oops. parenthesis. starter mistake!!! thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now