rcb007 Posted 17 hours ago Posted 17 hours ago Would it be possible to have a dcl list with a check boxes like the below. String the commands together? ( ) Command 1 ( ) Command 2 ( ) Command 3 ( ) Command 4 ( ) Command 5 If i were to select Command 1 and Command 4. It would run those commands in order? If i were to select Command 3, Command 4, and Command 5. It would run those commands? My initial thought is in the back end to have several iterations of each possible options. Just not sure what would be the best approach for this. Thank you for the ideas. Quote
GLAVCVS Posted 14 hours ago Posted 14 hours ago Of course it is possible Have you already written the dcl and commands? Quote
rcb007 Posted 13 hours ago Author Posted 13 hours ago I think i have it almost working. It seems to be doing what I want it too. (defun c:checkbox (/ dcl_id result cmd1 cmd2 cmd3 cmd4 cmd5) (setq dcl_id (load_dialog "checkbox.dcl")) (if (not dcl_id) (progn (alert "Failed to load DCL file!") (exit) ) ) (if (not (new_dialog "checkbox_dialog" dcl_id)) (progn (alert "Error loading dialog.") (exit) ) ) (setq cmd1 "0" cmd2 "0" cmd3 "0" cmd4 "0" cmd5 "0") (set_tile "cmd1" cmd1) (set_tile "cmd2" cmd2) (set_tile "cmd3" cmd3) (set_tile "cmd4" cmd4) (set_tile "cmd5" cmd5) (action_tile "accept" "(setq cmd1 (get_tile \"cmd1\") cmd2 (get_tile \"cmd2\") cmd3 (get_tile \"cmd3\") cmd4 (get_tile \"cmd4\") cmd5 (get_tile \"cmd5\") result T) (done_dialog 1)" ) (action_tile "cancel" "(setq result nil) (done_dialog 0)") (start_dialog) (unload_dialog dcl_id) (if result (progn (if (= cmd1 "1") (C:Command1)) (if (= cmd2 "1") (C:Command2)) (if (= cmd3 "1") (C:Command3)) (if (= cmd4 "1") (C:Command4)) (if (= cmd5 "1") (C:Command5)) ) ) (princ) ) (defun c:command1 () (alert "Command 1 Selected") (princ) ) (defun c:command2 () (alert "Command 2 Selected") (princ) ) (defun c:command3 () (alert "Command 3 Selected") (princ) ) (defun c:command4 () (alert "Command 4 Selected") (princ) ) (defun c:command5 () (alert "Command 5 Selected") (princ) ) checkbox_dialog : dialog { label = "Select Commands"; : toggle { key = "cmd1"; label = "Command 1"; } : toggle { key = "cmd2"; label = "Command 2"; } : toggle { key = "cmd3"; label = "Command 3"; } : toggle { key = "cmd4"; label = "Command 4"; } : toggle { key = "cmd5"; label = "Command 5"; } : row { : button { key = "accept"; label = "OK"; is_default = true; } : button { key = "cancel"; label = "Cancel"; is_cancel = true; } } } Quote
GLAVCVS Posted 12 hours ago Posted 12 hours ago Yes It seems like it should work 13 hours ago, rcb007 said: I think i have it almost working. It seems to be doing what I want it too. (defun c:checkbox (/ dcl_id result cmd1 cmd2 cmd3 cmd4 cmd5) (setq dcl_id (load_dialog "checkbox.dcl")) (if (not dcl_id) (progn (alert "Failed to load DCL file!") (exit) ) ) (if (not (new_dialog "checkbox_dialog" dcl_id)) (progn (alert "Error loading dialog.") (exit) ) ) (setq cmd1 "0" cmd2 "0" cmd3 "0" cmd4 "0" cmd5 "0") (set_tile "cmd1" cmd1) (set_tile "cmd2" cmd2) (set_tile "cmd3" cmd3) (set_tile "cmd4" cmd4) (set_tile "cmd5" cmd5) (action_tile "accept" "(setq cmd1 (get_tile \"cmd1\") cmd2 (get_tile \"cmd2\") cmd3 (get_tile \"cmd3\") cmd4 (get_tile \"cmd4\") cmd5 (get_tile \"cmd5\") result T) (done_dialog 1)" ) (action_tile "cancel" "(setq result nil) (done_dialog 0)") (start_dialog) (unload_dialog dcl_id) (if result (progn (if (= cmd1 "1") (C:Command1)) (if (= cmd2 "1") (C:Command2)) (if (= cmd3 "1") (C:Command3)) (if (= cmd4 "1") (C:Command4)) (if (= cmd5 "1") (C:Command5)) ) ) (princ) ) (defun c:command1 () (alert "Command 1 Selected") (princ) ) (defun c:command2 () (alert "Command 2 Selected") (princ) ) (defun c:command3 () (alert "Command 3 Selected") (princ) ) (defun c:command4 () (alert "Command 4 Selected") (princ) ) (defun c:command5 () (alert "Command 5 Selected") (princ) ) checkbox_dialog : dialog { label = "Select Commands"; : toggle { key = "cmd1"; label = "Command 1"; } : toggle { key = "cmd2"; label = "Command 2"; } : toggle { key = "cmd3"; label = "Command 3"; } : toggle { key = "cmd4"; label = "Command 4"; } : toggle { key = "cmd5"; label = "Command 5"; } : row { : button { key = "accept"; label = "OK"; is_default = true; } : button { key = "cancel"; label = "Cancel"; is_cancel = true; } } } Expand Quote
BIGAL Posted 7 hours ago Posted 7 hours ago This would be my front end can have up to about 20 choices, see multi toggles. Just having a think how make a command from a string etc maybe a Eval or read. This worked. (setq str (list "circle" "0,0" "10")) (foreach val str (command val)) You do a foreach of the ans and look is it a "1" meaning you have selected that item. So run that command. Multi toggles.lspFetching info... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.