Dynamically Change Foxpro Grids


I have some clients who would like to be able to diynamically change our program, you know add remove columns, change width and column sizes, fonts sizes, etc..  I have some ideas on how to do this, but I was wondering if someone has already invented the wheel and posted an example somewhere of how to do this in the most efficient way.

Who is Participating?
One thing to begin with is that the users have to be made to understand that a VFP Grid is not an Excel worksheet.  

If that is what they want, then utilize an Excel worksheet object within a form.

But you can give the users a degree of flexibility within a VFP Grid, and then store the parameter changes.  
Then, when the grid is next needed, VFP can access the stored parameters and modify the grid accordingly using those changes.

There are also grid 'tools'.classes/etc, out there that have been developed by others like ourselves to do much of what you want.  Some creative Googling will likely find some worth looking at.

Good Luck

CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
What you can do is provide dropdowns of the fields which they need to include in the grid and save that setting till the next time they open the same program.

You also need to write a script to take of alignment and size depending on field type and size.
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

The last time I created something like this within the display form itself I limited what the users could change to:
     Which column's displayed
     Column sequence

The users could readily move columns around and change the column size (including shut them off).  
When the user left the form, these parameters were saved and used the next time the form was launched.
Obviously this approach worked on a 'form grid'-by-'form grid' basis and was not universally applicable across all grids in the application.

But, for those users, it satisfied 90+% of what they wanted and other things like:
were merely 'nice to have' features which, for them, wasn't worth doing.

But, as CaptainCyril says above, those other parameter settings can also be saved and used.  
Implementing a means for user input to acquire those last parameters might be a little challenging, but it can be done.   You could always use a separate User Configuration Definition form to acquire the user's preferences and then utilize those values whenever ANY grid is displayed in a Form.

Also recognize that the forms might originally display a little slower on the forms when implementing those changes since it generally takes a little extra time to sequence through all of the individual columns and implementing user settings such as display/no-display/column width/etc parameters.

Good Luck

fmoore0001Author Commented:

That was the answer.  Neat class and gives my users near total control of the grid.

Knew there was something out there.

fmoore0001Author Commented:
One note for anyone who reads this.  The www.sweetpotatosoftware.com site has a BUNCH of useful VFP classes and utilties, stuff worth downloading.

Ought to make a list up of such places.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.