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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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

Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.