GetEntity usage
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
GetEntity usage

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
Guest






Posted: Wed Jan 05, 2005 1:40 am    Post subject: GetEntity usage Reply with quote

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.

Back to top
aks
Guest





Posted: Wed Jan 05, 2005 7:52 pm    Post subject: Re: GetEntity usage Reply with quote

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.


On 4 Jan 2005 12:40:41 -0800, John_Doe@inbox.ru wrote:

Quote:
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.
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB