check boxes

Started by Atwist, August 24, 2012, 02:40:29 AM

Previous topic - Next topic

Atwist

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
Atwist

I'm sorry because English is not my native language


Thanks for your help

vladgothe

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.

Atwist

#2
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" "")
)
Atwist

I'm sorry because English is not my native language


Thanks for your help

vladgothe

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

Atwist

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
Atwist

I'm sorry because English is not my native language


Thanks for your help

vladgothe

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

Atwist


no, this does not
Get an error message
see below


Atwist

I'm sorry because English is not my native language


Thanks for your help

Fred Tomke

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
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Atwist

Hi Fred,

Indeed I make a new button and now it works.
Atwist

I'm sorry because English is not my native language


Thanks for your help