Text Boxes Only Work Once

Started by dbsilverbullet, July 01, 2014, 06:33:45 AM

Previous topic - Next topic

dbsilverbullet

I have built a Modeless form with about 11 text boxes that are used to enter values.  When you click the Insert button on my form it triggers the OnClick event to create a set of objects based on the values that it retrieves from the text boxes. Code: (setq pwdth (atof (dcl-control-GetText pwdth))).  The functionality works perfect the first time that you click the button and everything is drawn just right, but the problem is that when you click the button again(whether you have changed and values or not) I get an exception error: "Invalid argument type" on the dcl-control-GetText function stating argument:0.  It seems as though the controls are going inactive and I can't get them to re-activate.

owenwengerd

It's difficult to guess what the problem is without more information and code to reproduce.
Owen Wengerd (Outside The Box) / ManuSoft

dbsilverbullet

#2
Attached is the OpenDCL Modeless form and the associated LISP file.  There are some other things in it that might not be perfect in it, but the main issue is that you can not click the "Insert Front View" button more than once.

owenwengerd

Your code is overwriting the control handles:
Code (autolisp) Select
(setq pwdth (atof (dcl-control-GetText pwdth)))

After this code executes, pwdth is a floating point value instead of the control handle it started out as.
Owen Wengerd (Outside The Box) / ManuSoft

dbsilverbullet

That made my week.  Fixed the problem and the form has been unleashed.  Thank you very much.  I had it in a format that I was using with DCL code that worked and didn't know that it would not in ODCL.  Thanks again.

dbsilverbullet

#5
Well I have a new issue with the same program.  If you use one buttons to draw the object and then use another tool, such as the move tool.  When you click on the button on the form again to draw another object from the form it calls that last tool(Move in this example) back up when you click to define the insertion point.

Update:
I was able to get the point to define the next time after using another tool and have trace it down to after it draws the first rectangle.  When it goes to draw the second rectangle it instead calls up that last used tool before clicking the button on my form again.

     (command "_RECTANG" ip bbbs "")
     (command "_rectang" ebrs ebre "");error happens when it tries to execute this line.

You can use the button over and over when the form is first initialized.  It is only after you use another AutoCAD tool and then go back to the Modeless form that this happens.

owenwengerd

It sounds like you may be sending an extra carriage return to the command line somewhere.
Owen Wengerd (Outside The Box) / ManuSoft

dbsilverbullet

That was it.  I was imitating the _LINE command and adding a "" to the end of the command that shouldn't have been there.

Thanks again.