tondog
asked on
In Delphi, How do I move the record pointer to the middle of the DBGrid's visible rows?
How do I move the record pointer to the middle of the DBGrid's visible rows?
In other words, if the height of the DBGrid is showing rows 21-43, then I want to move the pointer to row 31 or so.
(It doesn't have to be exact, i can just do integer division with DIV)
I was able to use:
THackCustomGrid(DBGrid1).V isibleRowC ount;
to get the number of visible rows.
But when I used
THackCustomGrid(DBGrid1).T opRow;
this integer value ALWAYS returns the number one.
In other words, if the height of the DBGrid is showing rows 21-43, then I want to move the pointer to row 31 or so.
(It doesn't have to be exact, i can just do integer division with DIV)
I was able to use:
THackCustomGrid(DBGrid1).V
to get the number of visible rows.
But when I used
THackCustomGrid(DBGrid1).T
this integer value ALWAYS returns the number one.
ASKER
ah
uhm.. are you saying it can't be done?
Can you recommend a different Grid module?
uhm.. are you saying it can't be done?
Can you recommend a different Grid module?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hmm
also, when i filter my database, the scrollbar really starts messing up.
I guess this is a common problem, as discussed here
https://www.experts-exchange.com/questions/10018314/Scrollbar-in-DBGrid-Delphi-3.html
Do you know if this paid module facilitates filtering?
Can you anyone recommend another way to filter? maybe with sql commands?
also, when i filter my database, the scrollbar really starts messing up.
I guess this is a common problem, as discussed here
https://www.experts-exchange.com/questions/10018314/Scrollbar-in-DBGrid-Delphi-3.html
Do you know if this paid module facilitates filtering?
Can you anyone recommend another way to filter? maybe with sql commands?
> Do you know if this paid module facilitates filtering?
Filtering is done the same way as other DB controls. I don't know specifically if it will solve your filter problem, but these TMS components smell good work. You should try with the demo version if it's ok with your needs.
Filtering is done the same way as other DB controls. I don't know specifically if it will solve your filter problem, but these TMS components smell good work. You should try with the demo version if it's ok with your needs.
try to set it to 3 just for fun, you will see it moves the grid 2 lines up but hides the bottom 2 lines
The position of the selected row (selected in the source) in the DBGrid view is ever changing, if you move forward or backward in your dataset it will put it at the top or bottom of the grid's view...
As a general advice, try to avoid using those DBGrid and StringGrid, they are the worst components ever made ! They do their basic stuff, but you get only problems when you want something more elegant or user-friendly.