Order Objects Constructed on a Window

Order Objects Constructed on a Window

I have a number of datawindows in a window. In a post-construct event I am making a call to another datawindow. Every so often when I open the window I get an error saying that the reference to the second datawindow is invalid. I think this is because the second datawindow has not been created yet. How can I adjust the order of the creation of the objects?

You are correct in your assumption that the datawindow is not constructed and is causing your problem. If you move the code to the parent level (i.e. window) you will not get this problem.

The sequence in which the controls is created is based on their layering within the window painter. You could make sure this sequence is always correct but it is better practice not to rely on this behavior.


Share the Post: