Jump to content

return to previous layer setting


Recommended Posts

Posted

hi everybody
after run my lisp something as font , osmode and other thing will change.
but i have question?
in the end of my code everything return to previous settings BUT
if stop my function by press Escape key, nothing Change to the previous state!

Posted

So I guess at the end of your code you will have some function that sets the variables (fonts, osmode and so on) back to what they were... but if you cause an 'error', say with the escape then the LISP will never get as far as these lines that return everything back to what they were.

 

Couple of things you can do, make the changes as short as possible. Some will change say OSMode in the first few lines of code, and reset it at the last line where in reality it might only need to be changed for 1 line of code (as an example),... so just change it for where it is needed (and if you need to change it a few times so be it if it will reduce errors)

 

Second thing you can do is to look into error trapping - a small sub routine that does stuff in the case of an error (such as hitting escape), it might be a simple error message "LISP Cancelled" or could do other things such as resetting variables back to how they were. 

  • Like 1
  • Agree 1

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...