General information
Category:
Forms & Form designer
>ThisForm.RemoveObject("the grid object name")
>Regenerate the underlying table any way you want.
>Thisform.Addobject("same grid object name","grid class name")
>grid.visible=.t.
Don't add/remove grids in a complicated form...
If you deal too much with grids, you can get frustrate. The rule is: "With the Grid, ALWAYS use the easiest solution". Don't try to go deep or else you'll waste a lot of time. Read my nightmare with the Grid...
A few months ago, I was dealing with grids in this structure:
Form
->PageFrame
->Pagex
->Container
->ComboBox
->Grid
The pages & containers & comboboxs & grids where added dynamically to the form. (Later, I stop doing this).
When you change the pages, in the pageframe, the view for the grid must refresh the data using a key from the combobox in the same container.
There is only one view for the all the grids.
I'm using a pretty subclassed Grid, and tried the RemoveObject / AddObject method. But when closing the form, you have to throw away all the controls from the form in the order that they were created. If you fail in doing this, the form WON'T DISAPPEAR. (And when you do a CLEAR ALL, it will crash your app with the frightening "Application Error" from Windows).
I spent weeks with this problem, and tried 5 methods for doing the "thing". And then I found that the best solution is to:
1. Don't add the grids at runtime, and
2. =REQUERY("view")
THIS.grid.refresh()
in the UIEnable() method of the current page.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only