KeyboardAccelerator Property (ActiveX)

Specifies the Windows standard or AutoCAD classic keyboard.

Supported platforms: Windows only

Signature

VBA:

object.KeyboardAccelerator
object

Type: PreferencesUser

The object this property applies to.

Property Value

Read-only: No

Type: acKeyboardAccelerator enum

Remarks

No additional remarks.

Examples

VBA:

Sub Example_KeyboardAccelerator()
    ' This example returns the current setting of
    ' KeyboardAccelerator. It then changes the value, and finally
    ' it resets the value back to the original setting.
    
    Dim preferences As AcadPreferences
    Dim currKeyboardAccelerator As Integer
    
    Set preferences = ThisDrawing.Application.preferences
    
    ' Retrieve the current KeyboardAccelerator value
    currKeyboardAccelerator = preferences.User.KeyboardAccelerator
    MsgBox "The current value for KeyboardAccelerator is " & currKeyboardAccelerator, vbInformation, "KeyboardAccelerator Example"
    
    ' Change the value for KeyboardAccelerator
    If currKeyboardAccelerator = acPreferenceClassic Then
        preferences.User.KeyboardAccelerator = acPreferenceCustom
    Else
        preferences.User.KeyboardAccelerator = acPreferenceClassic
    End If
    MsgBox "The new value for KeyboardAccelerator is " & preferences.User.KeyboardAccelerator, vbInformation, "KeyboardAccelerator Example"
    
    ' Reset KeyboardAccelerator to its original value
    preferences.User.KeyboardAccelerator = currKeyboardAccelerator
    MsgBox "The KeyboardAccelerator value is reset to " & preferences.User.KeyboardAccelerator, vbInformation, "KeyboardAccelerator Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_KeyboardAccelerator()
    ;; This example returns the current setting of
    ;; KeyboardAccelerator. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
    
    ;; Retrieve the current KeyboardAccelerator value
    (setq currKeyboardAccelerator (vla-get-KeyboardAccelerator (vla-get-User preferences)))
    (alert (strcat "The current value for KeyboardAccelerator is " (if (= currKeyboardAccelerator acPreferenceClassic) "Classic" "Custom")))
    
    ;; Change the value for KeyboardAccelerator
    (if (= currKeyboardAccelerator acPreferenceClassic)
        (vla-put-KeyboardAccelerator (vla-get-User preferences) acPreferenceCustom)
        (vla-put-KeyboardAccelerator (vla-get-User preferences) acPreferenceClassic)
    )
  
    (alert (strcat "The new value for KeyboardAccelerator is " (if (= (vla-get-KeyboardAccelerator (vla-get-User preferences)) acPreferenceClassic) "Classic" "Custom")))
    
    ;; Reset KeyboardAccelerator to its original value
    (vla-put-KeyboardAccelerator (vla-get-User preferences) currKeyboardAccelerator)
    (alert (strcat "The KeyboardAccelerator value is reset to " (if (= (vla-get-KeyboardAccelerator (vla-get-User preferences)) acPreferenceClassic) "Classic" "Custom")))
)