check boxes

Started by Atwist · 2012-08-24 09:40 UTC · 8 replies · SMF topic #1877

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
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.
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

(defun c:cadtool_Main_Chbpurlay_OnClicked (Value /)
(dcl_Control_Setvalue cadtool_Main_Chbpurlay 1 )
(command "-purge" "LA" "*" "N" "")
)
Oh, I understand now. If the checkbox is selected and you click the button, you want to execute the commands.
Try this code:


(defun c:cadtool_Main_Chbpurlay_OnClicked (Value /)
(if (= (dcl_Control_Getvalue cadtool_Main_Chbpurlay) 1 )
        (command "-purge" "LA" "*" "N" "")
)
)
Okay I did, but how do I link a button that the assignments are made​​.

I have now made ​​this


(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
Try this code instead:

(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")
)
)

no, this does not
Get an error message
see below


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
Hi Fred,

Indeed I make a new button and now it works.