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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding Grid columns

Status
Not open for further replies.

mpgalvin

Programmer
Feb 5, 2001
119
IE
I have an 8-column grid bound to a database. If the value of a particular field is empty, I want to hide the relevant column (so field1 is empty, hide column1)

I tried:

WITH thisform.grid.columnx
.width=0
.movable=.F.
.resizable=.F.
ENDWITH

but it still puts a line in for the seperator. If I hide 2 or 3 columns in a row (like I would normally be doing), then I get this big thick black line, which just looks like I'm trying to hide something (which I am, but I'd prefer the user knows nothing about it).

I tried removing grid lines for cell seperators, but it just replaces the thick black line with a thich grey one (!). Is there anyway I can totally 'remove' the column? Note, I don't want to really remove it, since depending on the contents, if I select a different master record, I may want to bring them back.
 
Some suggestions which I've implemented in various ways:

You can play around with the order the columns appear in. If you set a column's "columnorder" property to 1, for example, it will swap that column with the first column. Then you have a few choices. You can resize the grid so the other columns are simply not visible, but the user could still scroll the grid to find them. You could set the column's "visible" property to .F. in addition to resizing the grid. You could even set the column's "enabled" propery to .F. so the user CAN'T scroll over to it. You'll also want to remove the horizontal scroll bar from the grid (set the grid's "scrollbars" property to 2 for vertical only or 0 for none).

Hope that helps instead of confusing you!
 
chpicker, originally I had it that the unused columns were moved to the left hand side of the grid, and all used columns were expanded to fill the gap.

That was what I was using a table for the recordsource, and was able to match columns to specific fields. Unfortunately, I've had to change it so that it uses a dynamic cursor, and so I can't ControlSource the columns. When I use the ColumnOrder method to move, the data is still bound to the original columns.

So if Column8 is "table.comment", then if I move Column8 to the fourth in the table, it gets the value of the fourth field in the bound a1 cursor.

Strange, but that's what it's doing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top