Modal Form (VB6 DLL)
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
Modal Form (VB6 DLL)

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





Posted: Tue Mar 15, 2005 4:56 am    Post subject: Modal Form (VB6 DLL) Reply with quote

Here is the code in a form that is shown vbModal. See the problem in the comments:
[pre]Private Sub Button_Click()
Me.Hide
AcadDoc.Utility.GetEntity SelectedObject, Point, vbCr + "Select a polyline: "
Me.Show vbModal
' code down here does not get executed until the form is closed
' so I have to move it above the Me.Show line
End Sub[/pre]
Why this problem with the location of the code?

More info...

Have a dialog in a VB6 DLL that works fine in 2004/2005. In testing with AutoCAD 2006 an error message says that the form must be modal.

So I made the form modal if the version# is > 16.1 so it can still be non-modal for 2004/2005. When I made it modal I saw the problem listed above.

(since the 2006 beta is over and the NDA is released I hope it is ok to talk about this)

Back to top
Jorge Jimenez
Guest





Posted: Tue Mar 15, 2005 6:28 am    Post subject: Re: Modal Form (VB6 DLL) Reply with quote

That's the way a modal form is supposed to work.
Once itīs loaded, your program will wait until the
modal form is unloaded to continue. User input is locked
for any other form in your program.

We've had some quirks testing our software on 2006
but this is normal for a beta. Need to wait for final release.
--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica

"GTVic" <nospam@address.withheld> wrote in message
news:18354769.1110844638469.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
Here is the code in a form that is shown vbModal. See the problem in the
comments:
[pre]Private Sub Button_Click()
Me.Hide
AcadDoc.Utility.GetEntity SelectedObject, Point, vbCr + "Select a
polyline: "
Me.Show vbModal
' code down here does not get executed until the form is closed
' so I have to move it above the Me.Show line
End Sub[/pre]
Why this problem with the location of the code?

More info...

Have a dialog in a VB6 DLL that works fine in 2004/2005. In testing with
AutoCAD 2006 an error message says that the form must be modal.

So I made the form modal if the version# is > 16.1 so it can still be
non-modal for 2004/2005. When I made it modal I saw the problem listed
above.

(since the 2006 beta is over and the NDA is released I hope it is ok to
talk about this)
Back to top
GTVic
Guest





Posted: Tue Mar 15, 2005 8:41 am    Post subject: Re: Modal Form (VB6 DLL) Reply with quote

I think you may have misunderstood. The code is all in the modal form - no separate program.

The form is hidden to get user input on the AutoCAD screen and then re-shown. This occurs in the click event of a button on the form. Once the form is shown again the remainder of the code in the click event fails to run until the form exits.

Greg

Back to top
Jorge Jimenez
Guest





Posted: Tue Mar 15, 2005 10:03 am    Post subject: Re: Modal Form (VB6 DLL) Reply with quote

Ok. I get it now.
Yes that's the way to do it using a modal form

What exactly is the code that is not executing after the me.show ??

--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica

"GTVic" <nospam@address.withheld> wrote in message
news:9880643.1110858104711.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
I think you may have misunderstood. The code is all in the modal form - no
separate program.

The form is hidden to get user input on the AutoCAD screen and then
re-shown. This occurs in the click event of a button on the form. Once the
form is shown again the remainder of the code in the click event fails to
run until the form exits.

Greg
Back to top
Terry W. Dotson
Guest





Posted: Tue Mar 15, 2005 5:22 pm    Post subject: Re: Modal Form (VB6 DLL) Reply with quote

GTVic wrote:

Quote:
Me.Show vbModal
' code down here does not get executed until the form is closed
' so I have to move it above the Me.Show line
End Sub[/pre]

From the VB6 Help:

"When Show displays a modeless form, subsequent code is executed as it's
encountered. When Show displays a modal form, no subsequent code is
executed until the form is hidden or unloaded."

Terry
Back to top
Jorge Jimenez
Guest





Posted: Tue Mar 15, 2005 10:59 pm    Post subject: Re: Modal Form (VB6 DLL) Reply with quote

How's the form loaded the first time around ??

Are changing the mode after the me.hide ??


--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica


"GTVic" <nospam@address.withheld> wrote in message
news:9880643.1110858104711.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
I think you may have misunderstood. The code is all in the modal form - no
separate program.

The form is hidden to get user input on the AutoCAD screen and then
re-shown. This occurs in the click event of a button on the form. Once the
form is shown again the remainder of the code in the click event fails to
run until the form exits.

Greg
Back to top
GTVic
Guest





Posted: Fri Mar 18, 2005 3:40 am    Post subject: Re: Modal Form (VB6 DLL) Reply with quote

The form is originally loaded as modal and reshown as modal. The code after the Show processes the data gathered during the hide. So the effect was as if the data was not gathered.
Back to top
GTVic
Guest





Posted: Fri Mar 18, 2005 3:42 am    Post subject: Re: Modal Form (VB6 DLL) Reply with quote

Thanks Terry - who would have thought to look it up in the help :) Switching back and forth from VB6 and VBA isn't fun. Lots of inconsistencies like this - wish they were more similar.
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