0 Members and 1 Guest are viewing this topic.
It's called a "modeless" dialog, the other type is "modal". Yes, you can create a modeless dialog with opendcl.
;; use this template
Can I leave DCL(don't close it),then run commands or do other things in CAD? I mean,to create a DCL like a toolbar.when I click some buttons on this DCL, then run the function defined by DCL,After it lost focus, I can run CAD commands.Dear Sir,this code copy www.mjtd.comCode: [Select](defun C:test( / id i ok) (setq id (load_dialog "star test.DCL")) ;load DCL (if (new_dialog "dcl_test" id) (progn (setq i 1) (repeat 6 (init_image i) ;assign an action to the image_button ;(action_image i) (setq i (1+ I)) ) (action_tile "C1" "(action_command 1)") ;assign an action to the button 1 (action_tile "C2" "(action_command 2)") ;assign an action to the button 2 (action_tile "C3" "(action_command 3)") ;assign an action to the button 3 (action_tile "C4" "(action_command 4)") ;assign an action to the button 4 (action_tile "C5" "(action_command 5)") ;assign an action to the button 5 (action_tile "C6" "(action_command 6)") ;assign an action to the button 6 ;;of course ,you can do it by (repeat) (setq ok (start_dialog)) ) (alert "Can't load the dialoag!") ) (unload_dialog ID) (princ));;; initializate the image_button.;;; and assign an action to an image_button(defun init_image (key / k tile) (setq k (itoa key)) (setq tile (strcat "I" k)) ;tile (start_image tile) (fill_image 0 0 (dimx_tile tile) (dimy_tile tile) key ) (end_image) ;fill tile with different color (set_tile tile (strcat "Fun" k)) ;set the text of tile (action_tile tile (strcat "(action_command " k ")")) ;action);;; assign an action to an command_button(defun action_command (key) (cond ((= key 1) (alert "Please enter your command1:") ;;add your code in here ) ((= key 2) (alert "Please enter your command2:") ;;add your code in here ) ((= key 3) (alert "Please enter your command3:") ;;add your code in here ) ((= key 4) (alert "Please enter your command4:") ;;add your code in here ) ((= key 5) (alert "Please enter your command5:") ;;add your code in here ) ((= key 6) (alert "Please enter your command6:") ;;add your code in here ) ))
(defun C:test( / id i ok) (setq id (load_dialog "star test.DCL")) ;load DCL (if (new_dialog "dcl_test" id) (progn (setq i 1) (repeat 6 (init_image i) ;assign an action to the image_button ;(action_image i) (setq i (1+ I)) ) (action_tile "C1" "(action_command 1)") ;assign an action to the button 1 (action_tile "C2" "(action_command 2)") ;assign an action to the button 2 (action_tile "C3" "(action_command 3)") ;assign an action to the button 3 (action_tile "C4" "(action_command 4)") ;assign an action to the button 4 (action_tile "C5" "(action_command 5)") ;assign an action to the button 5 (action_tile "C6" "(action_command 6)") ;assign an action to the button 6 ;;of course ,you can do it by (repeat) (setq ok (start_dialog)) ) (alert "Can't load the dialoag!") ) (unload_dialog ID) (princ));;; initializate the image_button.;;; and assign an action to an image_button(defun init_image (key / k tile) (setq k (itoa key)) (setq tile (strcat "I" k)) ;tile (start_image tile) (fill_image 0 0 (dimx_tile tile) (dimy_tile tile) key ) (end_image) ;fill tile with different color (set_tile tile (strcat "Fun" k)) ;set the text of tile (action_tile tile (strcat "(action_command " k ")")) ;action);;; assign an action to an command_button(defun action_command (key) (cond ((= key 1) (alert "Please enter your command1:") ;;add your code in here ) ((= key 2) (alert "Please enter your command2:") ;;add your code in here ) ((= key 3) (alert "Please enter your command3:") ;;add your code in here ) ((= key 4) (alert "Please enter your command4:") ;;add your code in here ) ((= key 5) (alert "Please enter your command5:") ;;add your code in here ) ((= key 6) (alert "Please enter your command6:") ;;add your code in here ) ))
Can I leave DCL(don't close it),then run commands or do other things in CAD? I mean,to create a DCL like a toolbar.when I click some buttons on this DCL, then run the function defined by DCL,After it lost focus, I can run CAD commands.Dear Sir,I thing u find this type tool, this code copy www.mjtd.comCode: [Select](defun C:test( / id i ok) (setq id (load_dialog "star test.DCL")) ;load DCL (if (new_dialog "dcl_test" id) (progn (setq i 1) (repeat 6 (init_image i) ;assign an action to the image_button ;(action_image i) (setq i (1+ I)) ) (action_tile "C1" "(action_command 1)") ;assign an action to the button 1 (action_tile "C2" "(action_command 2)") ;assign an action to the button 2 (action_tile "C3" "(action_command 3)") ;assign an action to the button 3 (action_tile "C4" "(action_command 4)") ;assign an action to the button 4 (action_tile "C5" "(action_command 5)") ;assign an action to the button 5 (action_tile "C6" "(action_command 6)") ;assign an action to the button 6 ;;of course ,you can do it by (repeat) (setq ok (start_dialog)) ) (alert "Can't load the dialoag!") ) (unload_dialog ID) (princ));;; initializate the image_button.;;; and assign an action to an image_button(defun init_image (key / k tile) (setq k (itoa key)) (setq tile (strcat "I" k)) ;tile (start_image tile) (fill_image 0 0 (dimx_tile tile) (dimy_tile tile) key ) (end_image) ;fill tile with different color (set_tile tile (strcat "Fun" k)) ;set the text of tile (action_tile tile (strcat "(action_command " k ")")) ;action);;; assign an action to an command_button(defun action_command (key) (cond ((= key 1) (alert "Please enter your command1:") ;;add your code in here ) ((= key 2) (alert "Please enter your command2:") ;;add your code in here ) ((= key 3) (alert "Please enter your command3:") ;;add your code in here ) ((= key 4) (alert "Please enter your command4:") ;;add your code in here ) ((= key 5) (alert "Please enter your command5:") ;;add your code in here ) ((= key 6) (alert "Please enter your command6:") ;;add your code in here ) ))