Jump to content

Reactor Question: ESC to end command


sublimation
 Share

Recommended Posts

So I have a 'bad' tendency to use the ESC key instead of the space bar to end a command.  Now that I am starting to use reactors this will likely become a problem, and rather than changing my behavior I'd like to bend my program to my will.  Currently one of my reactors changes the color of text in a dimension and the other strips xdata from copied geometry, except, of course, when I use the escape key -- even though the dimension text was modified or object copied.  Can anyone recommend a work around?  Should I call a different reactor event?

 

These are the 2 relevant dimension modification functions (the copy functions are similar enough).

(defun wp:dimtext:modify:callback (owner reactor params / data)
	(if (not (member (setq data (list owner reactor)) {wp:data}))
		(setq {wp:data} (cons data {wp:data}))
		)
	(vlr-command-reactor (list wp:app)
		(list
			(cons :vlr-commandended 'wp:dimtext:modify)
			(cons :vlr-commandcancelled 'wp:dimtext:modify:commandcancelled)
			(cons :vlr-commandfailed 'wp:dimtext:modify:commandcancelled)
			)
		)
	(vlr-remove reactor)
	(princ)  
	)

(defun wp:dimtext:modify:commandcancelled (reactor params / data) 
	(vlr-remove reactor)
	(if (and
			(listp {wp:data})
			(setq data (car {wp:data}))
			)
		(vlr-add (cadr data))
		)
	(setq {wp:data} (cdr {wp:data}))
	(princ)
	)

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...