Message 1 of 6
C# .NET AcadDocument.Activate Problem

Not applicable
11-13-2002
11:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Everyone,
I think there is a problem with the AcadDocument.Activate event when used in
C#.NET (possibly related to the wrapper). In the object browser, it doesn't
show up like the rest of the events (with a lightning bolt icon next to it)
and for all intents and purposes, appears to be a method. I looked in the
AutoCAD dev help file (that comes with AutoCAD) and lo and behold, there is
a method called Activate() AND an event called Activate.
In VB6 I never had a problem differentiating between the two of these. To
be honest, I never used the Activate() method, only the event. Now, in C#,
I am trying to use the event and I get an error at compile-time:
C:\VSJ\ACADBOM\BOMAX\BomDocument.cs(117): 'AutoCAD.IAcadDocument.Activate()'
denotes a 'method' which is not valid in the given context
This is the code:
// Instantiate the event delegates.
_docActivated = new
_DAcadDocumentEvents_ActivateEventHandler(onDocActivate);
_docDeactivate = new
_DAcadDocumentEvents_DeactivateEventHandler(onDocDeactivate);
_beginClose = new
_DAcadDocumentEvents_BeginCloseEventHandler(onBeginClose);
_beginSave = new
_DAcadDocumentEvents_BeginSaveEventHandler(onBeginSave);
_endSave = new _DAcadDocumentEvents_EndSaveEventHandler(onEndSave);
// Add our event handlers to the document's notify list.
acdDoc.Activate += _docActivate; // PROBLEM IS HERE
acdDoc.Deactivate += _docDeactivate;
acdDoc.BeginClose += _beginClose;
acdDoc.BeginSave += _beginSave;
acdDoc.EndSave += _endSave;
Anyone have any ideas?
Thanks,
Eric
I think there is a problem with the AcadDocument.Activate event when used in
C#.NET (possibly related to the wrapper). In the object browser, it doesn't
show up like the rest of the events (with a lightning bolt icon next to it)
and for all intents and purposes, appears to be a method. I looked in the
AutoCAD dev help file (that comes with AutoCAD) and lo and behold, there is
a method called Activate() AND an event called Activate.
In VB6 I never had a problem differentiating between the two of these. To
be honest, I never used the Activate() method, only the event. Now, in C#,
I am trying to use the event and I get an error at compile-time:
C:\VSJ\ACADBOM\BOMAX\BomDocument.cs(117): 'AutoCAD.IAcadDocument.Activate()'
denotes a 'method' which is not valid in the given context
This is the code:
// Instantiate the event delegates.
_docActivated = new
_DAcadDocumentEvents_ActivateEventHandler(onDocActivate);
_docDeactivate = new
_DAcadDocumentEvents_DeactivateEventHandler(onDocDeactivate);
_beginClose = new
_DAcadDocumentEvents_BeginCloseEventHandler(onBeginClose);
_beginSave = new
_DAcadDocumentEvents_BeginSaveEventHandler(onBeginSave);
_endSave = new _DAcadDocumentEvents_EndSaveEventHandler(onEndSave);
// Add our event handlers to the document's notify list.
acdDoc.Activate += _docActivate; // PROBLEM IS HERE
acdDoc.Deactivate += _docDeactivate;
acdDoc.BeginClose += _beginClose;
acdDoc.BeginSave += _beginSave;
acdDoc.EndSave += _endSave;
Anyone have any ideas?
Thanks,
Eric