Jump to content

Can I make the "pause" respond to ENTER-key or right-mouse-click


Carsten Trolle

Recommended Posts

First some background to this question:

Within a lisp function I would like to have block insert in a loop, where the user only left-clicks the give insertion point, loop should be ended at right-mouse-click or ENTER.

The actual insert is like this:

... some stuf

(while bContinue

(command "_.insert" BN pause 1 1 0)

(setq bContinue in some way)

)

... some more stuff

 

Maybe same thing can be achieved through different method, but I like the visual of the "insert" where the block is attached to the crosshair until insert.

Also I know that the ESC-key (or Cancel) will abort the lsp code at the pause.

But for consistency in my application I prefer the ENTER-key or the right-mouse-click.

Question is whether there is some way I can make the "pause" react on an ENTER so it aborts the "INSERT" and continue with the lisp code below it.

Alternative approaches are also welcome.

 

Hope somebody can help.

BR

Carsten

Link to comment
Share on other sites

The only way for the user to exit using either Enter or right-click would be to utilise the getpoint function:

(while (setq pt (getpoint "\nInsertion Point: "))
   (command "_.-insert" bn "_S" 1.0 "_R" 0.0 "_non" pt)
)

However, this will of course forgo the preview you receive when using the INSERT command.

 

The issue arises because when calling the INSERT command from the AutoLISP progam, the INSERT command takes focus from the program and you cannot interact with the user input to the command from within the AutoLISP program until the INSERT command has completed.

 

However, To continue with program evaluation after the user has pressed Esc, I would suggest using the following:

(while (vl-cmdf "_.-insert" bn "_S" 1.0 "_R" 0.0 "\\"))

This avoids the need to incorporate an error handler (redefined *error* function) in your program.

Link to comment
Share on other sites

You should be able to define a right click as ^C^C ( cancel / escape ) This was the default value for rights clicks for years and years. I still try to define my button menus with this.

 

***BUTTONS1
;
$p0=*
^C^C
^B
^O
^G
^D
^E
^T

 

My guess is that today, you will use CUI ( not my cup of tea )

 

-David

Link to comment
Share on other sites

Thanks for your reply David.

I have also not entered the CUI world myself.

Can the redefining of the Right-mouse-click and ENTER-key be restricted to only apply within a particular lisp function (if yes, can I get a hint on how to achieve this), or will it be more universal?

 

BR

Carsten

Link to comment
Share on other sites

Can the redefining of the Right-mouse-click and ENTER-key be restricted to only apply within a particular lisp function

 

Good question! Maybe someone knows of a way. -David

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
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...