TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: whdjr on October 17, 2008, 09:56:55 AM

Title: Problem with "ErrNo" and "Enter"
Post by: whdjr on October 17, 2008, 09:56:55 AM
I want to prompt the user to either pick a selection on screen or select some keywords I provided.  I also give them the option to just right click or press enter to select the default.  The problem is a right click or enter is detected as an ErrNo Code 52 which I then terminate the command.

Can I differentiate between a right click and pressing enter and how if possible?

Code: [Select]
(initget 6 "Apple Orange")
(entsel "\nSelect your favorite fruit [Apple/Orange] <Apple> :  ")
Title: Re: Problem with "ErrNo" and "Enter"
Post by: whdjr on October 17, 2008, 10:13:05 AM
I know the simplest solution would be to just take out the default and that would solve all my problems but I would like to try to leave it in if I can.
Title: Re: Problem with "ErrNo" and "Enter"
Post by: whdjr on October 17, 2008, 10:24:53 AM
If anybody comes up with a good option let me know, but for now I think I can let my right click not terminate the program during that one selection.
Title: Re: Problem with "ErrNo" and "Enter"
Post by: T.Willey on October 17, 2008, 11:38:05 AM
Something like this?

Code: [Select]
(initget 6 "Apple Orange")
(setq Sel
    (cond
        ((entsel "\nSelect your favorite fruit [Apple/Orange] <Apple> :  "))
        (t "Apple")
    )
)