Control of UI's execution order

How do I control the UI’s execution order using Open events, Constructors, etc.

In my case right now, I need to execute the Constructor of a window before a text-field inside the window executes its Open event.

Thanks

You have no control over this and you should write your code so it doesn’t rely on a certain order (because it might change).

Thanks. What would your recommend going about doing this? For example, should I put everything inside a Constructor instead of the Open event.

Thanks

I’m not totally sure, but AFAIK the guaranteed order is the following:

  1. Constructors of all controls and the window in no specific order
  2. Open events of all controls in no specific order
  3. Open event of the window

If a control instance is independent of other controls in the window, the code goes into the control’s open event.
If two control instances in the same window depend on each other, the code goes into the window’s open event.

When subclassing a control it gets more complicated. In that case my rules are for window and control subclasses:

Computed properties
Don’t create any computed properties - create a getter and a setter method (the setter method by using Assigns).
Properties
Never enter something in the default value text field in the IDE.
If possible initialize all properties in the Open event before raising the Open event defined in this subclass.
You might initialize a property in the constructor, if the property is declared in this subclass, but not if the property is declared in the super class.

[quote=121554:@Eli Ott]I’m not totally sure, but AFAIK the guaranteed order is the following:

  1. Constructors of all controls and the window in no specific order
  2. Open events of all controls in no specific order
  3. Open event of the window

If a control instance is independent of other controls in the window, the code goes into the control’s open event.
If two control instances in the same window depend on each other, the code goes into the window’s open event.

When subclassing a control it gets more complicated. In that case my rules are for window and control subclasses:

Computed properties
Don’t create any computed properties - create a getter and a setter method (the setter method by using Assigns).
Properties
Never enter something in the default value text field in the IDE.
If possible initialize all properties in the Open event before raising the Open event defined in this subclass.
You might initialize a property in the constructor, if the property is declared in this subclass, but not if the property is declared in the super class.[/quote]
Thanks. This is helpful. I am thinking that maybe I should tell the control to execute the window’s open event and blockout the window’s open event (using a separate method).

Oww. No. IMHO that would cause a world of confusion in your code. I have to side with Michael on side. Figure out a better way to write your code which is not so dependent on order of events. If things must execute in a certain order, put them in the same method.

I think I made it sound a lot more complex then it actually is. Do not worry.

Thanks