Solved

How to Disable the Vertical Scrollbar in the TDBGrid object

Posted on 2004-04-24
11
4,500 Views
Last Modified: 2011-03-06
I am using Delphi 7
I have a DBGrid object that shows a database table with just 5 records
The horizontal scroll bar only shows when the columns are bigger than the avaliable space, but vertical scrollbar shows always no mather the number of records

I don't want the vertical scrollbar to show at all on the grid, never.

Please help...
0
Comment
Question by:EternalNewbie
  • 6
  • 3
  • 2
11 Comments
 
LVL 17

Expert Comment

by:mokule
ID: 10908485

Place neat Panel on it
0
 

Author Comment

by:EternalNewbie
ID: 10908499
humm. is that "Neat panel" a standard Delphi component ?  
Can't remember of seeing it ?

if is notm would you please let me know where I can find it ?
0
 
LVL 17

Expert Comment

by:mokule
ID: 10908512

I mean standard TPanel neatly placed :)
0
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.

 

Author Comment

by:EternalNewbie
ID: 10908527
You mean a panel placed over the grid to hide the scrollbar ?

I am placing like 7 grids side by side to make a dinamic agenda ( 7 week days, 7 grids).

I guess I can place the grids to overwrite eachother and a panel on last one but that doesnt seem a professional way to do it. it must be a way to set the verticalscroll not to show.

I read that it can be done using TCustomGrid, but I don't know how to use that TCustomGrid.

0
 
LVL 17

Expert Comment

by:mokule
ID: 10908547

Yes I mean to hide every of Your 7 scroll bars with Tpanels. It'll be the fasted way to do it. There is no easy way of gettig rid of verticel scroll bar in DBGrid. At least I don't know it. If You set panel to be flat there will be no difference in look.
0
 
LVL 11

Assisted Solution

by:shaneholmes
shaneholmes earned 50 total points
ID: 10908556

You need to make a new component derived from TDBGrid for this. The
following shows an example for a TDBGRID descendent but the strategy
works with about every control that uses standard window scrollbars.

type
  TNoVScrollTDBGrid = Class( TDBGrid )
  private
    Procedure WMNCCalcSize( Var msg: TMessage );
      message WM_NCCALCSIZE;
  end;
 
procedure TNoVScrollDBGrid.WMNCCalcSize(var msg: TMessage);
var
  style: Integer;
begin
  style := getWindowLong( handle, GWL_STYLE );
  If (style and WS_VSCROLL) <> 0 Then
    SetWindowLong( handle, GWL_STYLE, style and not WS_VSCROLL );
  inherited;
end;


Shane
0
 
LVL 17

Accepted Solution

by:
mokule earned 75 total points
ID: 10908562

If You really want to fight with it You can also use

  ShowScrollBar(DBGrid1.Handle,SB_VERT,FALSE);
0
 

Author Comment

by:EternalNewbie
ID: 10908613
Perfect.

yours line works great mokule.

but shane, you've got me interested on that way to derive a component from another. I have read about it and looks the way to custumise about anything, even that I couldnt put it to work, still you've givven me material to try and learn.

I really feel bad about spliting points, but I feel that otherwise would be unfair.

Really hope no one gets hurt.

0
 
LVL 17

Expert Comment

by:mokule
ID: 10908808
Why do You feel bad while splitting points?
It's quite normal when You get real help from more than one person.
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10908832
Some points are better than none - Im sure Mokule can concur?

Shane
0
 
LVL 17

Expert Comment

by:mokule
ID: 10908883
Thats it :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…

840 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