I am doing my first modeless dialog routine for Acad 2006 in .net, and need some help.
When done, the tool I am making will let you pick an entity, then show a dialog (or update it if shown) with its properties.
The dialog will also have ways to change the items layer properties, and buttons to step up or down in the nesting level.
Its a rewrite of the free ChLayColt tool on cadthinking.com, I will give out complete code along the way and when done so people can learn from this project.
I am using VB.net and VS2005.
I started by creating the form. I did not do a user control since I don't want a palette in acad, just a form.
Question 1) can I use a user control to make a modeless dialog, just like how its done for a paletteset for acad? the adesk labs give an example for a palette but not for a modeless dialog...
So I am going to give this tool a command name of CCM for the moment, since its fast to type.
I outlined the tasks to do with comments, some are blank.
This code for the form works fine though so far, compiles, loads into acad, and shows fine:
<CommandMethod("CCM")> _
Public Sub ShowModalForm()
'get entity pick
'get properties
'show dialog box if not already
'lock doc
Dim docLock As DocumentLock
Try
docLock = Application.DocumentManager.MdiActiveDocument.LockDocument()
Dim modelessForm As frmMain = New frmMain()
Application.ShowModelessDialog(modelessForm)
docLock.Dispose()
Catch ex As Exception
End Try
End Sub
Question 2) Is the docLocking necessary? I read it was for modeless dialogs. Clarification requested if its needed when showing a form, or just when an action spawned by the form has to do something involving acad, like change a layer property.
Question 3) Since this dialog will stay open, how do I test if its already open when CCM is run? Obviously I'm new at .net, I could not find info on this one anywhere though.
Thanks for any help, feel free to point me to other examples of modeless dialogs, I could not find any.