Catch esc during move command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a program that makes a label and then automatically starts the move command so you can move the label to where you want. I want to make it so that when you press esc during the move command, before you click the second point, the program can recognize that and handle it. In the program, sel is a selection set and pntb is a predefined point. em and lp are variables used to handle errors.
(setq err (vl-catch-all-apply 'moveL (list sel pntb)))
(if (vl-catch-all-error-p err)
(progn
(print "moveErr")
(if (equal (vl-catch-all-error-message err) "Function cancelled")
(setq em 1)
(progn
(print (strcat "Error: " (vl-catch-all-error-message err) "."))
(setq em 2)
)
)
(setq lp 0)
)
)
(defun moveL(sel pntb)
(command "._move" sel "" pntb pause)
(princ)
)
Right now in my program, when I press esc during the move command, it just cancels the command and the label goes back to where it started and the program continues, but the program doesn't recognize that esc has been pressed. Is there a way for the program to recognize that esc has just been pressed during the move command?