DefaultAction in lookup form

Dynamics AX 2009 allows to define an action to run when double click occurs in a form grid. The typical usage is in list pages, where a “normal” form is open on double click.

The grid must be non-editable and the DefaultAction points to a button on the form (the button can be even hidden).

Imagine you want to create a lookup form, which is not closed automatically when a record is selected. Instead, it is closed by double click (it allows to perform some additional action in the lookup). If you block the form from closing in the close() method only, the standard action for lookup closing handles the click on a record and the DefaultAction (the MouseDblClick event) is never run.

The only thing to do is to guarantee that super() in closeSelect() is not called in that moment – DefaultAction begins to work as expected.