GetEntity usage

Discussion in 'AutoCAD' started by John_Doe, Jan 4, 2005.

  1. John_Doe

    John_Doe Guest

    Consider the following code:

    Dim pnt As Variant
    Dim obj As AcadObject

    Do
    On Error Resume Next
    ThisDrawing.Utility.GetEntity obj, pnt
    If Err.Number = 0 Then
    'Do something meaningful - something was selected
    ..................
    Else
    'didn't select anything
    On Error GoTo errhandler
    Exit Do
    End If
    Loop

    I have found that Err.Number is -2147352567 both when user clicked on
    the empty space or pressed Enter key. Is it possible to distinquish
    between these 2 cases ? What I am trying to accomplish is to exit from
    the loop ONLY if Enter key was pressed but not when user clicked on the
    empty space.
     
    John_Doe, Jan 4, 2005
    #1
  2. John_Doe

    aks Guest

    I don't think the "regulars" will see your post. Unlike other
    newsgroups Autodesk filters out all posts that are not made through
    Autodesk's channels. To answer your question, I think you have to use
    a VBA KeyboardStateClass routine to perform your own check as to
    whether or not the enter key was pressed. That is what I do and I got
    it from a similar post to this NG. You can search for VBA
    KeyboardState routines in both this NG and the overall web. Sorry I
    don't have a link handy, but it is a common solution and so I think
    you will find it easy enough.

    Checking the the KeyboardState turns out to be fairly easy. You will
    find that it opens up all sorts of interface possibilities that you
    cannot do with straight AutoCAD VBA.
     
    aks, Jan 5, 2005
    #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.