FormButtonControl object not initialized

I ran into very strange thing in AX 2009.

Problem:

I added a group in the form design, put a tab in this group and since then wasn’t able to open a form properly. Whenever there was a call to a form control which had AutoDeclaration set to Yes, an error poped up “FormButtonControl object not initialized” (or for some other form control). The code was in the active method of the DataSource. If I commented all these calls, the form would open without errors but it wouldn’t show anything: no grid, not tabs, etc.

Solution:

Then I moved the new group down, below tabs and everything was OK. I guess AX doesn’t like when the first thing in design is group. But there are so many forms where this is the case.

Question:

I have no idea what was the problem and I would be very glad if anyone has an idea.

I’ve seen strange behavior in some cases when a form was changed and not recompiled in a whole. It might be the case.

I compiled the form many times before posting here. Also restarted AX, synchronized datasource table, restored table and a form…