Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
User-defined grid's layout
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01153465
Message ID:
01153842
Views:
16
Well, after discussing the problem with the manager we decided to go "hard-coded" route. In other words, we would have just an integer field in the profile defining format (1 or 2, it's ulikely we would have multiple formats) and will do sort of case statements to know how to prepare data and present the grid.

We also decided whether in the future more formats are needed, the code will have to be re-written again. But we're willing to gamble it's unluckily to happen...

>That should work, if you are not doing the entire grid you have to prevent the grid from blowing up with one of the standard techniques. Also this adds the column to the end of the grid so you may need to adjust the column order as well.
>
>Bob
>
>>>Hello,
>>>
>>>If you want to add a column dynamically you can use .AddObject with a subclassed custom grid column. Also please note there are some security issues associated with the method described in the article depending on where the data is and who has access. You can inject a case statement to just allow certain properties to be user managed.
>>>
>>>HTH
>>>
>>>Bob
>>>
>>I was thinking along these lines:
>>
>>thisform.myGrid.ColumnCount = thisform.myGrid.ColumnCount + 1
>>++++++++++++ Info from script
>>thisform.myGrid.Columns(thisform.myGrid.ColumnCount).ControlSource = ...
>>thisform.myGrid.Columns(thisform.myGrid.ColumnCount).width = ...
>>etc.
>>
>>*****************
>>In other words, have only the new column definition in the memo field.
>>Do you think this approach can work?
>>
>>Or you would suggest to define each possible requested field (so far there are only two combinations) as a class (may be in code) and just add a new column.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform