Do I use the LockDocument method apporiatly?
Hey Tim,
Anytime that an object implements the IDisposable interface and it needs to be disposed, you should use the Try..Catch..Finally construct, or what I generally prefer, wrap everything in a Using(DocumentLock docLock = ...) {} block.
So if I read you correctly, you would have done something like (not tested)
public void ShowMyDialog()
{
using (DocumentLock docLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();)
{
MyDialog modalForm = new MyDialog();
Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(modalForm);
}
docLock.Dispose();
}
or
public void ShowMyDialog()
{
try
{
MyDialog modalForm = new MyDialog();
Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(modalForm);
}
catch
{
}
finally
{
}
}
Nothing to dispose of, since I don't get and 'object' right? Or am I way off base. I know, I'm slow, but I'm trying. Thanks for your help Bobby.
Tim;
You are doing your homework my friend, I do not have the IDE installed at home, but will try your sample ... can you describe each of the steps (I asked this, because that's how I was able to understand what I know now about ObjectARX/C++) - that will help others better.
Cheers!
Sure Luis. I dl'ed the artice
here which helped a lot with understanding dialog boxes (forms), even though it is written for VB.net (I had to become a member, so that I could dl the pdf version of the file [its free]). Once I had the look of the dialog I wanted, I then changed each objects properties.
First I changed the "Cancel" buttons properties: I anchored it to both the right side, and the bottom of the form
Second I changed the "Okay" buttons properties: I also anchored it to the bottom and right side, but the right side of this button is anchored to the left side of the "Cancel" button (which happens by default), so they will always be the same space apart.
Third I change the "richTextBox" properties: I anchored this on all sides, so the bottom is now anchored to the top of the buttons, so now that space is always the same.
The order of the anchoring is important. I'm not sure if it's the order of the anchoring, or the order of making the items in the form. But my worked with the ordering of the anchoring, so that is what I'm going to go with.
Then I saw that I could make the dialog as big or as small as I wanted. This didn't work because you could make it so small that you couldn't see anything. So on the form there is an area for minimum and maximum size. You can set those to what you want. A helpful hint I noticed is, there is also a property that tells you the current size of the dialog, so you can use that as a starting point.
Hope that is what you wanted Luis.