Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Show container in a grid
Message
 
 
To
04/04/2018 15:57:28
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01659151
Message ID:
01659159
Views:
35
>>>>Hi,
>>>>
>>>>I want to show a container in a grid. I have done it before and it worked. But this one does not work.
>>>>
>>>>Here is what I did:
>>>>
>>>>I created a container with some labels and textboxes. Then I set the grid column1 currentcontrol to this container. Then I removed the default text control from the grid. So now the grid has just one column with the currentcontrol pointing to the container name. I set the column Sparse to .F. (although I even tried .T. with the same results). I set the grid ColumnCount to 1.
>>>>
>>>>When I run the form, the records of the base cursor are shown in the grid with many columns. As if the container within the grid does not exist.
>>>>
>>>>What else could I check?
>>>
>>>I presume you're setting this up at design time, and at runtime the grid appears to "reset" itself? If so, that sounds like you're running into "grid reconstruction"
>>
>>I think you are right. But I don't know how to prevent it. I think I ran into this issue before; just need to remember how I resolved it. At least now I know where to focus. Thank you.
>
>Have you tried "disassociating" the grid from the record source (e.g. setting recordsource to blank), just before something like a requery() (or anything else that might be rebuilding the table, such as PACK), then reassigning the record source?

Actually I did try setting RecourdSource to empty string. And then setting it to the actual cursor. But it didn't work.
The "trick" was that when the grid is created it should not have anything bound to it. That is, as I said in another message, when I set the BindControls to .F. before creating the grid and then setting it to .T., it started working as desired.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform