How to set a checkbox as checked

Started by scott_cd, February 10, 2017, 04:57:55 AM

Previous topic - Next topic

scott_cd

I am trying to set a checkbox and I am not sure of the correct syntax and I am using the following code:

Code (autolisp) Select
(dcl-Control-SetProperty Tree_Survey/Form1/CheckBox7 1)

I understand that

0 = unchecked
1 = checked
2 = indeterminate

Using control property as below what is the PropertyApiName ?

(dcl-Control-SetProperty Tree_Survey/Form1/CheckBox7 PropertyApiName [as String] NewValue [as Varies])

Thanks in advance
Scott

marcoheuer

Code (autolisp) Select
(dcl-Control-SetValue Tree_Survey/Form1/CheckBox7 1)

best regards
marco
Marco Heuer
Dipl. Ing.
www.arc-aachen.de
Airport Office

scott_cd

(dcl-Control-SetValue Tree_Survey/Form1/CheckBox7 1)

Hi Marco

Thanks forthat.

I have as you suggested changed it to set value but I still get the following error - see attached image?

Nil value not allowed ?


roy_043

The error message suggests that Tree_Survey/Form1/CheckBox7 control does not exist.

scott_cd

Would it help if I post my odcl file?


scott_cd

my odcl file is attached.

Thanks for helping

Scott

roy_043

Initializing the dialog must be done in an event handler called OnInitialize (to quote the Help).
Code (autolisp) Select
(defun c:Tree_Survey/Form1#OnInitialize (/)
  (dcl-Control-SetValue Tree_Survey/Form1/CheckBox7 1)
)

scott_cd

Yes that makes sense... ;D

Thanks again.