some questions of modeless form with textbox and button on Returnpress

Started by khann, June 24, 2010, 07:46:49 PM

Previous topic - Next topic

khann

Hi.
I'm testing just simple code of modeless form with 2 textboxs and 1 button.
(tested odcl ver. 6.0.0.27 and AcadMap 2005 , Win XP sp2.)

At first I wondered why button does not have Returnpressed event.

In the test, pressed Tab, controls get focus from top to bottom.
Pressed Enter Key passes two textboxs but button closes the Form.


First question is :
Return pressed on the button I want to stop to check whether close the form or sustain.
I've checked the (dcl_form_close ) method and CancelClose Event.

  (dcl_Form_Close TEST_form {DialogStatus [as Long]})

  (defun c:TEST_form_OnCancelClose (Reason [as Integer] /))

I hope to get some sample of this context :
"A return value of T prevents the dialog from closing; otherwise the dialog is closed."


Second question is :
When the Form's Cancel and OK Event starts.
Return pressed on the button it goes to CancelClose and Close Event no other Event runs.

And the last question is :
Pressed the upper right corner "x" close button crashes the ACAD.
What's wrong with this test code?

Hope someone check the attached test code.
Thanks.

owenwengerd

The Events sample demonstrates the use of OnCancelClose. I didn't test your code, but I suspect that the call to (dcl_Form_Close) from within the event handler is probably what is causing the crash.
Owen Wengerd (Outside The Box) / ManuSoft

khann

Thanks, Owen for your reply.
Ok, so what is the right usage of (dcl_Form_Close) method not the event ?
Can you show me a sample?

owenwengerd

Take a look at the Events sample. The reason your call to (dcl-Form_Close) is suspicious is because the OnCancelClose event handler is called when the form is already closing.
Owen Wengerd (Outside The Box) / ManuSoft

khann