Solved

Scrollbar and DBGrid

Posted on 2004-09-15
6
706 Views
Last Modified: 2010-04-04
Hi,

The question is quite simple, but not the answer i guess (not for me i mean): I want the scrollbar in a dbgrid doesn't move when i click on a record, and be able to move the scrollbar keeping the record that is selected, viewing the whole list in the dbgrid.

I hope have well explained, sorry my english.
0
Comment
Question by:ttrobin
6 Comments
 
LVL 6

Expert Comment

by:Amir Azhdari
ID: 12070354
Hi, try to work with these functions :

EnableScrollBar
GetScrollPos
GetScrollInfo
GetScrollRange
ScrollDC
ScrollWindow
ScrollWindowEx
SetScrollInfo
SetScrollPos
SetScrollRange
ShowScrollBar

Regards
Azhdari
0
 

Author Comment

by:ttrobin
ID: 12073714
hi Azhdari,

I have tried the functions u gave me, but they doesnt work the way i want. I can move the scrollbar to the position i want, but the dbgrid list doesnt scroll at the same time, and doesnt keep the focused record...

Thanx anyway but, someone else have any idea?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 12073778
thats not so easy, just because if you scroll the
scrollbar the grid scrolls the dataset as well,
which causes that other records become currentrecord

my advice would be to use a bookmark as pointer
to your "currentrecord", then you can easily return
to your record with the gotobookmark-method

just as suggestion

meikl ;-)
0
 

Author Comment

by:ttrobin
ID: 12153028
Hi kretzschmar,

Bookmark doesnt work as i wish. Thnx anyway

Any help please!!! :)
0
 
LVL 2

Accepted Solution

by:
cula99 earned 125 total points
ID: 12471916
Hi,

try to set dbgrid.options.multiselect to true. With that your row will be selected all the time and you can scroll all dataset. If you need data from that record you'll have to find that one. Also put some variable to count number of selected records, maby then you can use bookmark to reatreve that particular record.

Cula
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question