Hi,
I am using the CADImage.Select(x, y) method in a mousedown event for a CADPictureBox.
When I do it returns a Null Reference exception, below is the stack trace
at CADImport.FaceModule.CADImportFace.SelectObject(CADEntity ent)
at CADImport.CADSelector.Select(Int32 x, Int32 y)
at CADImport.CADImage.Select(Int32 x, Int32 y)
at frmDxf.cadPictBox_MouseDown(Object sender, MouseEventArgs e)
Error Message: Object reference not set to an instance of an object.
I don't believe it should bubble up an error, or should it?
CADImage.Select Method Bug
Moderators: SDS, support, admin
Re: CADImage.Select Method Bug
Hello.
Please specify the code you use for selecting entity. Have you tried our EditorDemo application for this task? If the exception occur on specific file then please send it to us for the testing.
Alexander.
Please specify the code you use for selecting entity. Have you tried our EditorDemo application for this task? If the exception occur on specific file then please send it to us for the testing.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
-
- Posts: 16
- Joined: 31 May 2010, 13:33
Re: CADImage.Select Method Bug
Hi Alexander,
I have found the cause for the bug. It seems I didn't have a reference to a PropertyGrid control set to the EntityPropertyGrid property in the CADImportFace class.
i.e. CADImportFace.EntityPropertyGrid = this.propGrid;
Here is the code from the FAQ_Demo.Net example
As soon as I created a propertygrid control on my form and assigned it to the EntityPropertyGrid property then I was able to select (click my mouse) in the CADPictureBox control without generating the Object reference error. Without a propertygrid control set to the EntityPropertyGrid property I was unable to use the CADPictureBox control.
As a work around I made the grid invisible and placed it somewhere out of the way because for that form I don't want a propertygrid control.
I have found the cause for the bug. It seems I didn't have a reference to a PropertyGrid control set to the EntityPropertyGrid property in the CADImportFace class.
i.e. CADImportFace.EntityPropertyGrid = this.propGrid;
Here is the code from the FAQ_Demo.Net example
Code: Select all
private void InitExtParam()
{
Initial3DOrbit();
#region protect
#if ((! floatprotect) && protect)
this.miFloatLic.Enabled = false;
#endif
#endregion
InitLng();
InitSettings();
SetAllFormsSettings();
this.clipRectangle = new ClipRect(this.cadPictBox);
this.clipRectangle.MultySelect = false;
this.miCopyAsBMP.Shortcut = Shortcut.CtrlC;
CADImportFace.EntityPropertyGrid = this.propGrid; //Here is the reference you MUST have to not crash the CADPictureBox control!
this.cadPictBox.MouseWheel += new MouseEventHandler(CADPictBoxMouseWheel);
this.cadPictBox.ScrollEvent += new CADImport.FaceModule.ScrollEventHandlerExt(CADPictBoxScroll);
}
As a work around I made the grid invisible and placed it somewhere out of the way because for that form I don't want a propertygrid control.
Re: CADImage.Select Method Bug
Hello Scott.
This isn't a bug, the CADImage.Select method constructed for visual selection mostly. It call the FaceModule.CADImportFace.SelectObject that creates and sets an object in EntityPropertyGrid. However the property grid must be initialized. In our demo property grid initialization take place on MainForm initialization. You can realize your own programmatically method if necessary.
Alexander.
This isn't a bug, the CADImage.Select method constructed for visual selection mostly. It call the FaceModule.CADImportFace.SelectObject that creates and sets an object in EntityPropertyGrid. However the property grid must be initialized. In our demo property grid initialization take place on MainForm initialization. You can realize your own programmatically method if necessary.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support