C ++ Builder developed a drop

xiaoxiao2021-03-06  104

Wednesday, 2004-10-20 Wednesday, the form of the OldCreateORDER attribute.

If you want to ask you, the form of constructor and the code in the oncreate event are executed, you may not hesitate to answer the code of the constructor first. In fact, this is not the case, and recently encounters such a problem when using the form. I first defined a basic form TchildBaseform, and then creating a form TUSERINFOFORM as the basis as the basis. When the program is discovered, it is actually the TUSERINFOFORM form on the oncreate event processing code to execute before executing, and then execute the code of the constructor. Why is there such a situation? Later I find the help of TForm, I found that TFORM has such an attribute OldCreateOrder to see how the help is explained:

When OldCreateOrder is false (the default) the OnCreate event occurs after all constructors are finished (from the AfterConstruction method) and the OnDestroy event occurs before any destructors are called (from the BeforeDestruction method).

This timing differs from C Builder 1, where the OnCreate event occurred when the TCustomForm constructor executed and the OnDestroy event occurred when the TCustomForm destructor executed. Applications that require the OnCreate event and OnDestroy events to occur from the constructor and destructor of the form CAN Set OldcreateOrder to True.

That is, if the OlderCreateOrder property is set to false, the oncreate event triggers after all constructor is complete, and the ONDESTROY event triggers before the destructor call. Conversely, OlderCreateOrder is equal to TRUE and the order is the opposite. Now, the OLDERCREATEORDER default is for False, but if you inherit from a custom form, this property value is True, unless you handle it (you can't see this property in the property editor, Can only modify the DFM file).

转载请注明原文地址:https://www.9cbs.com/read-103524.html

New Post(0)