Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting empty Grid Rows invisible

Status
Not open for further replies.

SimplyES

Programmer
Oct 5, 2012
39
GB
I would like to have a fixed size grid where rows are only visible when there is data to fill them. Using a button to add a record adds a new visible row. I have seen this idea applied but cannot find any way of achieving it. Is it possible with the standard grid or is this something that will require a custom class?
 
You can't control the height or visibility of individual grid rows - only of the grid as a whole.

However, you can remove the empty records from the cursor that you use to populate the grid. That will have the effect that you looking for.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Remember that a Grid MUST have a DataSource in order to exist.
And if that Grid's DataSource is a Table/Cursor, it must have one or more records.

However these records may indeed be Empty and you can use SET FILTER TO !EMPTY(whatever) or SET FILTER TO !DELETED() (where the Empty records are Deleted) or SET ORDER TO <some Tag> (where the Index expression uses FOR !EMPTY(whatever) or FOR !DELETED() as a parameter) to make those Empty records not appear in the Grid.

You are not actually 'removing' the Empty records, you are just controlling their 'visibility'.
So when you are done with the Form, you might want to prevent 'deadwood' from entering your 'live' data by really Eliminating (maybe use: DELETE & PACK, or some other means) these Empty records.

Good Luck,
JRB-Bldr


 
Thanks NEE4NEE. That's getting closer. I reckon I can adapt that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top