Modeless Dialog display problem

Modeless Dialog display problem

william.klawitter4MJ74
Contributor Contributor
684 Views
3 Replies
Message 1 of 4

Modeless Dialog display problem

william.klawitter4MJ74
Contributor
Contributor

Hello,

 

I have a modeless dialog that upon a button click opens a drawing file via DocumentCollectionExtension.Open which returns a Document Object.  (acCheckedOutDocument)

After that line I Hide the dialog so the user can work with the drawing they just opened.

I have Handled the BeginDocumentClose Event where I try to Show the dialog.  I have tried numerous things however my dialog will not come to the forefront - it stays behind the AutoCAD Application window.  Please Help.

 

Here is where the document is opened (you can see I have tried a few things here)

'Me.Visible = False
'Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView()
DocumentCollectionExtension.Open(Application.DocumentManager, CheckedOutDrawingFileName, False)
acCheckedOutDocument = Application.DocumentManager.MdiActiveDocument
'acCheckedOutDocument.Editor.StartUserInteraction(Me)

'Using acLock = acCheckedOutDocument.LockDocument
' Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView()
'End Using
Me.Hide()

 

Here is what I have tried in the BeginDocumentClose event.

Private Sub acCheckedOutDocument_BeginDocumentClose(sender As Object, e As DocumentBeginCloseEventArgs) Handles acCheckedOutDocument.BeginDocumentClose
'MsgBox("begin document close")
'Me.Visible = True
'Me.Activate()
'Me.BringToFront()
'Autodesk.AutoCAD.Internal.Utils.EnableFloatingWindows(True)
Me.Show()

Me.Activate()
'Application.ShowModelessDialog(vbNull, DrawingCatalog.JEDwgCatDrawingCatalogForm, True)
Me.BringToFront()
Me.CheckOutJeacButton.Focus()
Application.ShowModelessDialog(vbNull, DrawingCatalog.JEDwgCatDrawingCatalogForm, True)
acCheckedOutDocument = Nothing
End Sub

0 Likes
685 Views
3 Replies
Replies (3)
Message 2 of 4

_gile
Consultant
Consultant

Hi,

 

You should use a user interface which inherits from PaletteSet instead of a modeless dialog (see this topic at TheSwamp).

Maybe you can get some inspiration from this discussion which shows how to play with the Visible property.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 4

william.klawitter4MJ74
Contributor
Contributor

I solved the issue - I had to handle the document activated event since my app is MDI, when the drawing was close AutoCAD would activate the previous drawing in the document collection - hence making the autocad application window upfront once again.

0 Likes
Message 4 of 4

william.klawitter4MJ74
Contributor
Contributor

Thanks for the reply - I may consider this however I have many hours into this app as is at this point.  See my other post for my resolution.

0 Likes