.NET

.NET

Reply
Valued Contributor
61 Posts
0 Kudos
Registered: ‎02-20-2007
Post 1 of 4
Accepted Solution

Disable keyboard delete key on autocad loading

236 Views, 3 Replies
03-13-2014 01:49 PM

Hi,

 

Does anyone ehere knows how to disable keyboards keys (e.g. delete key, enter key, spacebar key) once autocad load.

 

Thanks and regards,

SCLuna

I think I found the solutions to do this by implementing

ObjectOverrule

Valued Contributor
61 Posts
0 Kudos
Registered: ‎02-20-2007
Post 2 of 4

Re: Disable keyboard delete key on autocad loading

03-14-2014 02:04 PM in reply to: scluna

I think I found the solutions to do this by implementing

ObjectOverrule

SCLuna
Valued Contributor
91 Posts
1 Kudo
Registered: ‎08-22-2013
Post 3 of 4

Re: Disable keyboard delete key on autocad loading

03-14-2014 11:37 PM in reply to: scluna
could you post your key code showing how to realize this?
Valued Contributor
61 Posts
0 Kudos
Registered: ‎02-20-2007
Post 4 of 4

Re: Disable keyboard delete key on autocad loading

03-15-2014 07:47 AM in reply to: swaywood

Here is the code I got from reading an article from dev blog but I forgot the link.

 

Public Class CErase
        Inherits ObjectOverrule
        Public Overrides Sub [Erase](dbObject As DBObject, erasing As Boolean)
            MyBase.[Erase](dbObject, erasing)
            Throw New Autodesk.AutoCAD.Runtime.Exception(ErrorStatus.NotApplicable, "Use DrawingTool Delete command to delete Spaces.")
        End Sub
    End Class

    Shared objEraseOverRule As EraseOverrule = Nothing

    Public Shared Sub PreventErase()
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        If objEraseOverRule Is Nothing Then
            objEraseOverRule = New EraseOverrule()

            ObjectOverrule.AddOverrule(RXObject.GetClass(GetType(Entity)), objEraseOverRule, False)
            ObjectOverrule.Overruling = True
        Else
            ObjectOverrule.RemoveOverrule(RXObject.GetClass(GetType(Entity)), objEraseOverRule)
            objEraseOverRule.Dispose()
            objEraseOverRule = Nothing
        End If
    End Sub

SCLuna
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!