Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Grid not filling up window completely...

Grid not filling up window completely...

Grid not filling up window completely...

Hi everyone... i dont know if i can consider this as a problem... but my grid is not filling up the window, only 8 items is shown, after that if i add another item, it shows the scroll bar already eventhough i still have 4 blank rows... May i ask for a solution please... thanks....

RE: Grid not filling up window completely...

To fit grid on your form use its anchor property.
To hide scrollbars set ScrollBars property of grid to 0.

RE: Grid not filling up window completely...

If you set Scrollbars to 0 (none) the scrollbar don't show.

Otherwise the scrollbar region is there even with 0 records, to illustrate:

What appears after I add two records is the slider of the scrollbar, but the scrollba is already there from the beginning.

The slider is the darker gray rectange inside the scrollbar region, here shown in a grid with 2 records. The slider initially is full height. Is that what you mean?

The slider, which is sized as the portion of records you see in comparison to all records, will shrink when you add many more items and the visual portion is shrinking, but it's naturlly full height if you see all records. The question is rather, why it's only appearing when you have 2 or more records (at least that's what I experience), it's kind of logic it's missing with no records, but should be there when the first record exists.

The whole scrollbar is there from the start, though, it doesn't appear, it's already there. I wonder what you describe is the appearance of the slider of the scrollbar.

The simplest way to get rid of that, as initially said, is to set ScrollBars=0 and get rid of them overall. You have no influence on when VFP thinks the scrollbar slider should appear. You could also think about initially having no scrollbars and set Scrollbars to 2 (vertical) when you reach a reccount() that's one more than can fit into the grid height divided by rowheight (take into account the headers, too). Then you actually have both the scrollbar and its slider appear only when needed to scroll, in the moment you added the item that breaks the display limit.

Or you still keep the scrolllbars off, the scrollbar is not the only option to scroll down. There's mouse wheel scrolling and arrow keys. And, of course, you can simply add own buttons for up and down scrolling, perhaps even better suited for touch usage, as the scrollbar is very slim, so it can be "finger friendlier" with dedicated navigation buttons, can't it? And you don't need to fiddle with that problem.


RE: Grid not filling up window completely...


Are you saying that when you scroll down to the bottom of the grid, you are seeing a number of blank rows, that is, rows situated between the last actual row and the bottom of the grid? And that you don't want those blank rows to be visible? In other words, in those circumstances you want the last actual row of data always to be on the last row of the visible grid?

Have I understood your question correctly? If so, I can only say that you have hit on one of more annoying features of the VFP grid - and one for which (as far as I know) there is no easy solution.

However, if you happen to own a copy of 1001 Things You Wanted to Know About Visual Foxpro, you will find a very effective solution on pages 173 - 175. Unfortunately, the code is much too long for me to type here (even if I was allowed to). You might possibly find a copy on line somewhere, or it might be worth your while to buy the book.

Apologies if I have misunderstood the question.


Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Grid not filling up window completely...

Hi Ravindra, Chris and Mike... OMG... it worked... putting the scrollbars to 0. Thanks and God bless everyone....

RE: Grid not filling up window completely...

It's obviously the simplest solution, if you don't want or need them anyway. I wonder why you described what seems inconvenient to you about when the scrollbar (or slider) appears, as it seemed unlogical to you. But it also sounded like you wanted to control that appearance, not get rid of the scrollbar overall. That's much simpler, then.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close