I can't seem to find my original post regarding this issue, but it is about losing the current temp-table record in scope after returning from ShowDialog (and some other .NET method call) call.
|
It's not being passed as a parameter. Code structure is very simple.
FOR FIRST table:
. . .
Create an instance of a form
form:ShowDialog() set dlgResult.
if dlgResult is OK then
table.field1 = form:Property1. // at this point, table is out of scope
Delete form.
END.
I think someone has posted in my original post that it has something to do with how the code execution control is switch from .NET land back to ABL land. The context is somehow being lost. We encountered this error before, but the program is only dealing with one temp-table, so it is easy to just store the data needed and do the FIND again of the record outside of the FOR EACH for the update. However, for the current occurrence of the problem, there are already several different temp-table records in scope at the time the FOR EACH is executed that I'm afraid will also be forced to go out of scope.
Going off to .NET shouldn't matter. Are there things you're doing with that TT buffer in response to what happens in the dialog box? That might explain it. Otherwise, I believe it is a bug. So please log one. Thanks.
Going off to .NET shouldn't matter. Are there things you're doing with that TT buffer in response to what happens in the dialog box? That might explain it. Otherwise, I believe it is a bug. So please log one. Thanks.
Do you really lose the record ? Or do you lose the values in the record ?
Big difference between the two, and I have a possible/likely explanation for the latter (which *does* lie on the .NET side of things...):
Properties of .NET dialogs aren't reliable when the said dialog gets Dispose()'d, including properties defined on the ABL side.
By default a Form's DisposeDialogOnClose is set to true, so that means it will be disposed when the dialog is closed and the ShowDialog() returns.
And there have been changes (I assume bug fixes) somewhere between 11.5.1 and 11.7.5. that will now cause property values to disappear at that point.
If you want to make sure these things keep working correctly, reset the dialog's DisposeDialogOnClose to False, and make sure you Dispose() it after you've extracted the properties you need.
Sorry, I'm not following. Not sure what properties in a Form used as a dialog box has to do with the value of a TT record buffer.
P.S. My understanding is that the TT is not inside the form class, which is implied by the first post.
P.S. My understanding is that the TT is not inside the form class, which is implied by the first post.