OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Atwist on August 24, 2012, 02:40:29 AM

Title: check boxes
Post by: Atwist on August 24, 2012, 02:40:29 AM
Hello

I have about 10 check boxes that I want to select as I press the output button that the assignments are made​​.

How can I make this
Title: Re: check boxes
Post by: vladgothe on August 24, 2012, 03:15:16 AM
I guess when you say you want to "select" them, you mean you want them to be checked. To check a checkbox, you must set their value to 1. For example, if in Form1 from Project you want to check Checkbox1, this is the code to do it:
(dcl_Control_SetValue Project_Form1_CheckBox1 1). And you repeat this for other checkboxes, so for Checkbox2 you will write (dcl_Control_SetValue Project_Form1_CheckBox2 1) etc.
Title: Re: check boxes
Post by: Atwist on August 24, 2012, 04:26:15 AM
Not quite.

so I have 10 check boxes with 1 button ready.
If I now 5 checkboxes and then select the button ready to press the command of these 5 checkboxern be done.

So first select the commands and then press the button to make the assignment.

I have this

Code (autolisp) Select
(defun c:cadtool_Main_Chbpurlay_OnClicked (Value /)
(dcl_Control_Setvalue cadtool_Main_Chbpurlay 1 )
(command "-purge" "LA" "*" "N" "")
)
Title: Re: check boxes
Post by: vladgothe on August 24, 2012, 04:42:57 AM
Oh, I understand now. If the checkbox is selected and you click the button, you want to execute the commands.
Try this code:

Code (autolisp) Select

(defun c:cadtool_Main_Chbpurlay_OnClicked (Value /)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurlay) 1 )
        (command "-purge" "LA" "*" "N" "")
)
)
Title: Re: check boxes
Post by: Atwist on August 24, 2012, 04:52:04 AM
Okay I did, but how do I link a button that the assignments are made​​.

I have now made ​​this


Code (autolisp) Select
(defun c:cadtool_Main_cmdpuruit_OnClicked (/)
  (dcl_MessageBox "To Do: code must be added to event handler\r\nc:cadtool_Main_cmdpuruit_OnClicked" "To do")
)

(defun c:cadtool_Main_Chbpurbloc_OnClicked (Value /)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurbloc)1 )
(command "-purge" "D" "*" "N" "")
)
)
(defun c:cadtool_Main_Chbpurdim_OnClicked (Value /)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurdim)1 )
(command "-purge" "B" "*" "N" "")
)
)
(defun c:cadtool_Main_Chbpurlay_OnClicked (Value /)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurlay) 1 )
(command "-purge" "LA" "*" "N" "")
)


As I now know how to do it with the button then I'm already very happy

Thanks for your help
Title: Re: check boxes
Post by: vladgothe on August 24, 2012, 05:11:57 AM
Try this code instead:
Code (autolisp) Select

(defun c:cadtool_Main_cmdpuruit_OnClicked (/)
(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")
)
)
Title: Re: check boxes
Post by: Atwist on August 24, 2012, 06:48:57 AM

no, this does not
Get an error message
see below

(https://dl.dropbox.com/u/100214188/To%20Do%20error.bmp)
Title: Re: check boxes
Post by: Fred Tomke on August 24, 2012, 07:41:15 AM
Hi, I'd prefer to look at your project file. I guess there is a type mismatch or you have renamed the event handler name.

Regards, Fred
Title: Re: check boxes
Post by: Atwist on August 24, 2012, 10:09:20 AM
Hi Fred,

Indeed I make a new button and now it works.