The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> Delphi Programming
|
DBGrid and disappearing scrollbar
Discuss DBGrid and disappearing scrollbar in the Delphi Programming forum on Dev Shed. DBGrid and disappearing scrollbar Delphi Programming forum discussing Delphi related topics including Kylix, C++ Builder, and more. Delphi is a high-performance language, originally based on the PASCAL language.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

June 30th, 2007, 11:38 PM
|
|
Contributing User
|
|
Join Date: Oct 2004
Posts: 61
  
Time spent in forums: 1 Day 13 h 11 m 52 sec
Reputation Power: 10
|
|
|
DBGrid and disappearing scrollbar
This is a stupid question which I'm almost positive has a simple answer, but I can't figure it out. I am using 3 DBGrid components with corresponding datasource components tied to KADaoTable components. The 3 tables are joined together MasterSource/MasterFields. (They display artist, album, track information) You can click an artist, which filters the list of albums to show only those by that artist, then click an album and see the tracks in the third grid on that album. Simple stuff. The problem is sometimes (and I can't find the pattern) the vertical scroll bar on the right side of the DBGrid component is not displayed on the album and/or the track grid. You can press the down arrow key and scroll to the additional albums or tracks. Or, you can randomly click around to different albums/artists and the scroll bars will magically come back. Not 100% sure but I think is related to the KADao components. Any help would be great. Thanks!
|

July 1st, 2007, 12:58 PM
|
|
Contributing User
|
|
Join Date: Jan 2006
Location: Carlsbad, CA
|
|
|
I have no experience of KADaoTable.
My guess is it has to do with how many rows the DBGrid thinks are in the result set.
If it assumes only, or less than, the available rows in the grid it will hide the scrollbar.
Once you scroll down I presume more rows are fetched and the result set count gets larger.
See if KADaoTable lets you set the number or rows retrieved or something along those lines.
Clive
|

July 1st, 2007, 10:24 PM
|
|
Contributing User
|
|
Join Date: Oct 2004
Posts: 61
  
Time spent in forums: 1 Day 13 h 11 m 52 sec
Reputation Power: 10
|
|
|
A couple of things I have found...
I am able to get the number of records in the result set. I find it with KADaoTable->RecordCount. Unfortunately, the number it reports is always correct, although the scroll bar is not always present. I don't know what this means. The DBGrid component seems to display the scroll bar when the result set contains any more than one record. Even though I have more than enough room for 10+ records, the scroll bar shows if the result set contains only 2 records. It also seems as though the scroll bar disappears on the next record set following a result set of one. In other words- If you select an artist that has only one album, the DBGrib for albums will not display a scroll bar (This is OK). If the next artist has 15 albums, the scroll bar will not come back (Not what I want). (This seems trivial since most artists do not have 15 albums but I am having the same problem listing tracks on an album- the scroll bar is sometimes absent and you can't really tell if there are more tracks on an album without pressing down arrow) If you click another artist with only one album, then another artist with multiple albums, the scroll bar will come back until you hit another single-album artist. I have tried several procedures on DBGrid like DBGrid->Refresh() and DBGrid->Update(). They do not help.
I hope this indicates something to someone out there. I would really like to get this working.
Thanks
|

July 2nd, 2007, 12:53 AM
|
|
Contributing User
|
|
Join Date: Jan 2006
Location: Carlsbad, CA
|
|
|
Which version of Delphi?
|

July 2nd, 2007, 07:31 AM
|
|
Contributing User
|
|
Join Date: Oct 2004
Posts: 61
  
Time spent in forums: 1 Day 13 h 11 m 52 sec
Reputation Power: 10
|
|
|
Its C++ Builder 6.
|

July 2nd, 2007, 04:13 PM
|
|
Contributing User
|
|
Join Date: Oct 2004
Posts: 61
  
Time spent in forums: 1 Day 13 h 11 m 52 sec
Reputation Power: 10
|
|
|
More info...
It works fine on Windows 2000 machines. The problem is only on Windows XP.
|

July 2nd, 2007, 10:22 PM
|
|
Contributing User
|
|
Join Date: Jan 2006
Location: Carlsbad, CA
|
|
Quote: | Originally Posted by steve6341 More info...
It works fine on Windows 2000 machines. The problem is only on Windows XP. |
I have seen some comments elsewhere to the same effect and that it is a problem with Delphi6 (at least) and XP.
One suggestion I saw (slightly modified by me).
In the AfterScroll event of the parent Dataset add these two lines.
ChildDBGrid.Width := ChildDBGrid.Width +1;
ChildDBGrid.Width := ChildDBGrid.Width - 1;
I have no idea if it will work.
Clive.
|

July 2nd, 2007, 11:31 PM
|
|
Contributing User
|
|
Join Date: Oct 2004
Posts: 61
  
Time spent in forums: 1 Day 13 h 11 m 52 sec
Reputation Power: 10
|
|
|
Clive- That is great!
That works as a great workaround. This will fix a similar problem I have in 2 other apps. I can't thank you enough. I really appeciate you repeatedly following up with this thread. Thanks.
Steve
|

March 14th, 2013, 05:29 AM
|
|
Registered User
|
|
Join Date: Mar 2013
Posts: 1
Time spent in forums: 5 m 42 sec
Reputation Power: 0
|
|
|
Great fix thanks this helped me too.
ParamVDBGridWithTextValue.Width := ParamVDBGridWithTextValue.Width + 1; // Show Vertical Scroll bar
ParamVDBGridWithTextValue.Width := ParamVDBGridWithTextValue.Width + 1;
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|