'ESC' Key hit?

Discussion in 'AutoCAD' started by C Witt, Jun 23, 2003.

  1. C Witt

    C Witt Guest

    The problem:

    I have a VB script;
    Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
    If CommandName = "MOVE" Or CommandName = "COPY" Or CommandName =
    "ERASE" Or CommandName = "copyclip" Or CommandName = "_copyclip" Or
    CommandName = "stretch" Then
    ThisDrawing.Application.Preferences.Selection.PickGroup = True
    End If
    End Sub

    Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
    If CommandName = "MOVE" Or CommandName = "COPY" Or CommandName =
    "ERASE" Or CommandName = "copyclip" Or CommandName = "_copyclip" Or
    CommandName = "stretch" Then
    ThisDrawing.Application.Preferences.Selection.PickGroup = False
    End If
    End Sub

    but the problem is, if a user hits ESC then the groupmode is left on
    (bad, as we lose dblclick then). so, I am faced with a problem.. how
    to get around it?


    I've seen a few sugestions..
    " You can set a boolean global to true in the BeginCommand event and
    false int the EndCommand event. Then you can tell whether the command
    completed successfully by checking the global's value..."

    but am unclear as to how this would work..
     
    C Witt, Jun 23, 2003
    #1
  2. C Witt

    C Witt Guest

    With a lot of help from Victor Delgado, I have found the solution..

    add this to the acad.mnl file:

    (defun CancelCommand (reactor info)
    (setq *CmdName* info)
    (if
    (member *CmdName*
    '(("MOVE")
    ("COPY")
    ("ERASE")
    ("COPYCLIP")
    ("_COPYCLIP")
    ("stretch")
    )
    )
    (setvar "PICKSTYLE" 0)
    )
    )
    (vlr-command-reactor nil '(:)vlr-commandCancelled . CancelCommand)))



    Thanks.
     
    C Witt, Jun 24, 2003
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.