KeyboardAccelerator Example

Using Programming Languages other than 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

 

   Comments?