+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Jul 2010
    Posts
    24

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

    Registered forum members do not see this ad.

    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

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,322

    Default

    The only way for the user to exit using either Enter or right-click would be to utilise the getpoint function:
    Code:
    (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:
    Code:
    (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.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  3. #3
    Forum Deity David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    2,521

    Default

    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.

    Code:
    ***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
    R12 (Dos) - A2K

  4. #4
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Jul 2010
    Posts
    24

    Default Redefining Right-mouse click

    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

  5. #5
    Forum Deity David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    2,521

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by Carsten Trolle View Post
    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
    R12 (Dos) - A2K

Similar Threads

  1. Double "Click" w/TEXT vs Double "Click" w/MTEXT
    By Squirltech in forum The CUI, Hatches, Linetypes, Scripts & Macros
    Replies: 1
    Last Post: 18th Aug 2012, 02:11 pm
  2. Macro. Selecting objects with the pause "\"
    By xikes in forum The CUI, Hatches, Linetypes, Scripts & Macros
    Replies: 8
    Last Post: 28th Mar 2011, 08:57 pm
  3. (command "pause")
    By Tharwat in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 5th Jul 2010, 08:01 pm
  4. "@" slow to respond
    By mikef in forum AutoCAD General
    Replies: 24
    Last Post: 17th Apr 2009, 03:58 pm
  5. reconized mouse click or enter
    By jandres in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 9th Sep 2005, 01:06 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts