Header/Detail View with a dbCjGrid, and an On_Key Key_Scape defined at the view object.
Calls a modal dialog, which also has the same key defined..
Code:
On_Key Key_Escape Send Close_panel
the dialog is being called when the focus is exiting an specific form (on customer, under a certain condition).
If the user navigates using tab key, the dg is opened and closed using the ESC key just fine.
but If the user while the focus in on this particular form, uses the mouse and click in the cCjGrid, the dialog is opened as well, but now, if the user press the ESC key to close the dialog, the ESC is getting captured by BOTH cCjGrid and the DG objects..
The DG get's closed fine, but before that the grid had executed the (by delegation I guess) the close_panel as well, which destroys the ccjGrid inner COM objects as part of the "closing" mechanism.
So, after the dg is properly closed, the activation of the grid fails with the famous error
Code:
C:\DataFlex 18.2 Examples\Order Entry\Programs\Order.exe
Erro na invocação de método objeto COM. Attempt to use object before it's been initialized, pvComObject is NULL.
Erro: 4399
GET_COMCOUNT (7829) - oObject (939) - at address 59063
GET_COLUMNOBJECTSINDISPLAYORDER (10776) - oDetailGrid (931) - at address 69316
GET_FIRSTENTERABLECOLUMN (5811) - oDetailGrid (931) - at address 70306
MSG_ENTERINGGRID (10798) - oDetailGrid (931) - at address 70026
MSG_ENTERING (282) - oDetailGrid (931) - at address 69972
MSG_ACTIVATE (117) - oDetailGrid (931) - in native code
MSG_ACTIVATE (117) - oDetailGrid (931) - at address 2248
MSG_ACTIVATE (117) - oDetailGrid (931) - at address 71511
MSG_MOUSE_CHANGE_FOCUS (251) - DESKTOP (2) - in native code
[start] - at address 85897
Followed by a ACCESS VIOLATION and app crash.
Tested on 18.2 (customer environment) and also under DF 20.1 . Same result.
Attached views and dg, if added to the order sample can easily reproduce the problem.
Testview.vw
testdg.dg
Steps to reproduce:
- Add the view and dg to the order sample, compile and activate the new view
- find the fist order , using the 1st form (F8) ; (do not use tab to navigate)
- click in the grid using the mouse ;
- the dg will open, close it by pressing the ESC key ;
- kabum
Observations:
If the target object when leaving the form, is not a cjGrid, the issue does not happen ;
if you close the dg by clicking the OK button, the issue also does not happen ;
Off course, besides asking DAW to fix the bug.... does anyone has any smart idea to avoid this ?
Regards