Started by Atwist ·
2012-08-24 09:40 UTC ·
8 replies · SMF topic #1877
Atwist
2012-08-24 09:40 UTC
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
vladgothe
2012-08-24 10:15 UTC
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
2012-08-24 11:26 UTC
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" "")
)
vladgothe
2012-08-24 11:42 UTC
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" "")
)
)
Atwist
2012-08-24 11:52 UTC
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
vladgothe
2012-08-24 12:11 UTC
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")
)
)
Atwist
2012-08-24 13:48 UTC
no, this does not
Get an error message
see below
fred_tomke
2012-08-24 14:41 UTC
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
Atwist
2012-08-24 17:09 UTC
Hi Fred,
Indeed I make a new button and now it works.