Click or drag to resize

KeyboardEventType Constructor

Constructs an object from an event.

Namespace:  KSPDev.GUIUtils.TypeFormatters
Assembly:  KSPDev_Utils.2.0 (in KSPDev_Utils.2.0.dll) Version: 2.0 for KSP v1.8+
Syntax
C#
public KeyboardEventType(
	Event value
)
Request Example View Source

Parameters

value
Type: Event
The keyboard event.
Examples
public class KeyboardEventTypeDemo1 : PartModule {
  static readonly Message<KeyboardEventType> msg1 = new Message<KeyboardEventType>(
      "#TypeDemo_msg1", defaultTemplate: "Keybinding is [<<1>>]");

  // Depending on the current language in the system, this method will present different unit names. 
  void Show() {
    Debug.Log(msg1.Format(Event.KeyboardEvent("^1")));
    // Prints: Keybinding is [Ctrl+1]
    Debug.Log(msg1.Format(Event.KeyboardEvent("^[1]")));
    // Prints: Keybinding is [Ctrl+Alpha1]
    Debug.Log(msg1.Format(Event.KeyboardEvent("$^A")));
    // Prints: Keybinding is [Shift+Ctrl+A]
  }
}
See Also