Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8770483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:34:00+00:00 2026-06-13T17:34:00+00:00

Given that I want my string grid to have equal height rows … I

  • 0

Given that I want my string grid to have equal height rows …

I know that it will start with exactly 5 rows and I make it so at design time.

At run time I may want to add some extra rows (and I have code to not add below the bottom of the parent; at that point I rely on scroll bars).

It seems that sg.height := sg.height + sg.RowHeights[0]; is not producing the expected result – there is unexpecetd whitespace after the last row (I am still trying to calculate how the extra height corresponds to the number of rows, but it looks like it is the height of one row, no matter how many rows are in the grid).

Is there something else I should take into account? (perhaps GridLineWidth?) Or could I have set a property wrongly in the Object Inspector? Should I be using GridHeight, rather than Height?

Note: this problem only occurs when the stringgid is as wide as all cells and the scroll bar appears, drawing over part of the last column. If I leave an ugly blank sapce at the right of the string grid for the scroll bar to fit into, the problem does not occur.

Can anyone tell me the formula to calculate the new gridheight after adding a number of rows? Or wthere I am doing something wrong.


[Update] The fudge factor of 3 apears to correspond to the margin property

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:34:01+00:00Added an answer on June 13, 2026 at 5:34 pm

    I will add my trial and error to your research in case it’s of any value.
    TMS AdvStringGrid. Here is an image of a TMS AdvStringGrid. I think it is largely based on an ordinary string grid with a lot of useful extensions. To make it easier to count rows, I magnified the image using SnagIt and made the pixel gridlines visible. I added some red lines to the top row of the grid. On this grid, the DefaultRowHeight is set to 21. Between the red lines, there are 5 pixels each so to get 21 pixels for the DefaultRowHeight you would have to include the stringgrid gridline which has a height of 1 pixel. When I load this grid, I use this code:

    with gridLimits do
        begin
          RowCount := 3;
          Cells[0, 0] := 'Maximum Amount';
          Cells[0, 1] := 'Maximum Base';
          Cells[0, 2] := 'Maximum Period';
          IntegralHeight := False;
          MyHeight := 0;
          for i := 0 to RowCount - 1 do
            inc(MyHeight, RowHeights[i]);
          Height := MyHeight + 5;
        end;
    end;
    

    I captured the grid using SnagIt and let it capture an object on the screen. It included the 1 pixel grey line around the grid. The grid actually seems to visibly start at the blue line, so to get the height, I would think I would need to add the DefaultRowHeight times three plus the top blue line plus the bottom blue line, but if I do that and click on the bottom row, the grid scrolls up. It also scrolls up if I add 3 to the height. If I add 4 to the height, it does not scroll. I don’t know why I set it on 5 and I will set it to 4 now because you can see that there is 1 pixel too much at the bottom.

    It may be that the top and bottom grey lines should be added to get the total height of the grid and that is why it is the DefaultRowHeight times 3 plus the top and bottom lines plus two more for the grey lines that SnagIt included.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From the given string that is $codes I just want to have all language
Given a string, I want to retrieve a string that is in between the
I have a grid of data that I want to export to RTF, PDF
I have a list of lists that represent a grid of data (think rows
I have a Python module that I want to dynamically import given only a
SCENARIO: Given that a model called Edition has its community feature enabled I want
I want to understand how a C++ program that was given to me works,
I want to redefine an (default) implementation in a given windsor-container. Is that what
I'm working in PHP and I want to create a function that, given a
Given an IBOutlet pointer in Objective-C/iPad, how do you hide that element? Want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.