Hello Mark, Yes, i see what you mean, the crash. But this is documented. ;)
From help File for
EGN_CELLLEFTCLICK:
QuoteComments:
If The notification message returns TRUE, then no further actions will be taken, by default Egrid32 sends this message to Parent before performig the selection, but if Notification returns true, the selection will be cancelled.
The problem is that the notification is returning FALSE, so, Egrid32 is assuming everything is still fine, and tries to perform a cell selection as usual, but, in a grid that is most likely already deleted. This causes that Egrid32 tries to access memory blocks that are already freed.
Try this solution:
Function FORM1_EGRID321_EGN_CELLLEFTCLICK (ControlIndex As Dword, HwndForm As Dword, hEGrid As Long, wParam As Dword, lParam As Long) As Long
... code ... code ...
... code ... code ...
FF_CloseForm HwndForm
FUNCTION = %TRUE
End Function
Added: For more information, there is a topic named "Data Modification" wich talks exactly about this.
And from "How to find Bugs":
Situation #1: - You are getting a crash when processing a notification message yourself.This one can be annoying, i know. First of, make sure you are not modifying data that Egrid32 asumes that will be available after you process the notification message. If Egrid32 tries to access objects that you delete during the notification message, there is a high posibility that Egrid32 will complain. This can also happen if you modify -and not necessarily delete- something that Egrid32 Expects to find unchanged. For example, if you set a wrong internal selection during a selection notification. Or if you resize grid during an internal resizement of the grid.
Some notification messages can be returned with a TRUE (or some other values, depending in the notification message), to bypass what Egrid32 was going to do when notification message returned, so, if you are modifying something that you know Egrid32 will try to change after the notification message returns, its a good idea to answer to Egrid32's notification messages properly. Good comunication between Egrid32 and the parent dialog is the key!.
:)