Started by Atwist ·
2012-08-28 04:47 UTC ·
8 replies · SMF topic #1882
Atwist
2012-08-28 04:47 UTC
Hello,
I have a piece of programming designed with your help, I am getting an error message when I use the check boxes.
I understand that the check boxes are not allowed to be empty, but I do not use all the checkboxes.
Did the check boxes to "indeterminate", I think this is good.
(defun c:cadtool_Main_TextButton1_OnClicked (/)
(dcl_Project_Unload "Cadtool" T)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurbloc) 1)
(command "-purge" "B" "*" "N")
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurdim) 1)
(command "-purge" "D" "*" "N")
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurlay) 1)
(command "-purge" "LA" "*" "N")
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurlt) 1)
(command "-purge" "LT" "*" "N" "")
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurmat) 1)
(command "-purge" "MA" "*" "N" "")
)
roy_043
2012-08-28 07:36 UTC
Your problem is the use of (dcl_Project_Unload "Cadtool" T). After this line the controls in the form no longer exist and (dcl_Control_Getvalue cadtool_Main_Chbpurbloc) etc. will fail.
Try this instead:
(defun c:cadtool_Main_TextButton1_OnClicked ( / purBlockP purDimP)
; (dcl_Project_Unload "Cadtool" T) ; Don't do this!
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurbloc) 1)
(setq purBlockP T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurdim) 1)
(setq purDimP T)
)
; etc.
(dcl_Form_Close cadtool_Main)
(if purBlockP
(command "-purge" "B" "*" "N")
)
(if purDimP
(command "-purge" "D" "*" "N")
)
; etc.
)
Atwist
2012-08-28 09:54 UTC
Thanks Roy,
I will try this
Atwist
2012-08-28 12:48 UTC
I made this, but I still get the error.
With Vlisp looked but it gives no error.
Personally I do not where the error is now
(defun c:cadtool_Main_TextButton1_OnClicked ( / purBlockP purDimP purlayp purltP purmatP purshaP purtexsP purmlsP purtabsP purvisP purregP purallp)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurbloc) 1)
(setq purBlockP T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurdim) 1)
(setq purDimP T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurlay) 1)
(setq purlayp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurlt) 1)
(setq purltp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurmat) 1)
(setq purmatp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpursha) 1)
(setq purshap T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurtexs) 1)
(setq purtexsp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurmls) 1)
(setq purmlsp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurtabs) 1)
(setq purtabsp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurvis) 1)
(setq purvisp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurreg) 1)
(setq purregp T)
)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurall) 1)
(setq purallp T)
)
(dcl_Form_Close cadtool_Main)
(if purBlockP
(command "-purge" "B" "*" "N")
)
(if purDimP
(command "-purge" "D" "*" "N")
)
(if purlayP
(command "-purge" "la" "*" "N")
)
(if purltP
(command "-purge" "lt" "*" "N")
)
(if purmatP
(command "-purge" "ma" "*" "N")
)
(if purshaP
(command "-purge" "m" "*" "N")
)
(if purtexsP
(command "-purge" "sh" "*" "N")
)
(if purmlsP
(command "-purge" "st" "*" "N")
)
(if purtabsP
(command "-purge" "t" "*" "N")
)
(if purvisP
(command "-purge" "v" "*" "N")
)
(if purregP
(command "-purge" "r" "*" "N")
)
(if purallP
(command "-purge" "all" "*" "N")
)
)
roy_043
2012-08-28 13:41 UTC
I have built a quick test using my suggestion. The attached files work for BC12.2.17+ODCL7.0.0.6.
Atwist
2012-08-28 16:18 UTC
Sorry even now I get the error message

XDCAD
2012-08-29 04:41 UTC
Did you put the control variables in your function inside statement into local variables?
Atwist
2012-08-29 04:57 UTC
I have used the lisp and odcl from post # 5.
XDCAD
2012-08-29 05:29 UTC
Your error reason is the control variable is NIL, so
You check error control variable name, and then see the variable is in your LISP program other function definitions, give it a local variable declarations. If the local variable declaration, then the external control variable is not transfer function inside.