Hi,
author=Peter2 link=topic=2202.msg11067#msg11067 date=1416499217 wrote:
[...]
Probably a "greenly" question, but is there a kind of flow-diagram which displays the base of "load / show / hide / show / close / cancel / close" ...?
[...]
not sure, if you meant something like this, but may be this makes it more clear:
OnInitialize
It is called after form dcl-form-show method was called and all controls are available.
Please note: Between dcl-form-show and OnInitialize already some events are fired (TabSelChanged for instance).
Please note: It is not called after (dcl-form-hide oForm nil).
OnCancelClose
It is called after form dcl-form-close method was called or Enter or ESC are pressed in a control which doesn't handle these keys. Then this keypress will be lead to the form and handled there. In OnCancelClose you have the chance to "think about do I really want it" closing the form. For instance, if some information are missing you can show a messagebox or whatever. If you press ESC in a grid in editable state you can cancel grid editing and leave the form open. To suppress form closing you have to return true. To avoid closing the form after hitting Enter in a textbox or grid, I check the first argument intIsEsc and return (/= intIsEsc 1).
OnOk
It is called after OnCancelClose and before OnCancel and OnClose.
OnCancel
It is called after OnCancelClose, after OnOk (after hitting Enter in Textbox) and right before OnClose. Unfortunalety it seems to be called
twice after pressing ESC, but only once when clicking the cross in upper right corner or clicking the or clicking the Close form button. And unfortunately, it is also called after hitting Enter in textbox (just between OnOk and OnClose).
OnClose
It is called when the form is finally going to be closed - just right before none of the controls are available. It is just the last second to get the current values from the controls before they're getting destroyed.
Show
Method to create a new form instance. Note that you're responsible to check with dcl-form-isactive, if there's already an existing instance.
Close
Method to close and destroy an existing form instance.
Hide
Changes the visibility of a none-modal form. It is not available for modal forms, because the control cannot send back to AutoCAD.
Have a short look at the sample FormEventTester I've attached. And please note the return values of dcl-form-show!
Hope that helps a very little bit.
With regards,
Fred