locked
NAV 2009 R2 add-in event problem RRS feed

  • Question

  • Hello everyone, I hope this is the correct forum for my problem. I am developing an add-in for Microsoft Dynamics NAV 2009 R2, the add-in is supposed to read some data from an XML file and show the data in a grid control (of an additional library called Xtragrid). One of the tasks is to change the background color of a cell in the grid, and this is done by using event (the only appropriate way to do so in Xtragrid). And now the problem is, the event handler is not called when it is supposed to!

    I tried something simliar in a normal win form, using also the same event to change the background color of the cells, and it worked. The event handler is just not called when the grid control is integrated into NAV (wrapped by a panel).

    After encountering this problem, I tried something more to see where exactly the problem is. I created event handlers for many events of the objects in the add-in, such as some mouse events of the grid view (the class used to display data of the grid control, very wierd), data change events of the data table and so on, and only 2 or 3 of them fired, all the other did not.

    Then I tried also one more thing, created an event handler for the mouse click event of the grid control, so that each time the user clicks the grid, I increase a number in one fix cell. And it turned out that not every time the number was changed. I also debugged, and saw that every time the event handler was called, but just the number was not changed. After several times, the number was changed, and the number increased itself the actual times that the user clicked the grid.

    So I am thinking now, that the add-in base classes of the Dynamics framework UI Extensibilty are doing so special event handling other than letting the add-in to have fully control. And on the other hand, the add-in base classes are also doing some special painting events (perhaps these two are the same problem).

    Does anyone encounter this kind of problems? Or is there anything I am missing? So any suggestions or comments are welcome!

    Monday, November 14, 2011 8:42 AM

Answers

  • Problem was kind of solved. I modified the grid view before (for showing the columns and rows, which are actually not needed), and the event was not called. Now I removed the modification of the view, and it works. Still I may want to know why this happened, but I think this is not the problem of the framework, it is the problem of the Xtragrid.
    • Marked as answer by edwardcarlfox Monday, November 14, 2011 1:05 PM
    Monday, November 14, 2011 1:04 PM