sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    List of keyboard keys constants

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 732 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      kioobee
      last edited by

      I'm developping a tool class, and i'm in the process of handling keyboard events.
      I searched on the online doc, but i can't find a list of correspondence between a keyboard key and a value (the key is passed as an integer).
      Do such a list exist ?

      like

      Sketchup::KEY_A -> 32

      etc...

      I hope it exists !! And if not, at least that the 'A' key will always map to the same value ?

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        It can vary between PC and MAC and also remember that 'A' is probably assigned to the Arc shortcut so pressing A inside your tool will be taken as a deactivate() and start Arc...
        Keys like Esc call onCancel()
        The keys safely accessible to tools are typically the modifiers Shift/Ctrl/Alt etc [listed in the Key methods of the Tool API https://developers.google.com/sketchup/docs/ourdoc/tool#onKeyDown] and Tab [up only as down on MAC is ignored] - the Arrow-keys will be OK provided no one has ill-advisedly made shortcuts to those... and of course the basic numerals 0-9, and [.,;] used in dim/point-input, /x* used in Copy [Move/Rotate] and '"cmfik etc used as unit suffixes, in dimensions etc...
        There are several www sites setting out keyboard codes etc... http://en.wikipedia.org/wiki/Keyboard_layout#Character_keys http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00000520.html etc

        TIG

        1 Reply Last reply Reply Quote 0
        • K Offline
          kioobee
          last edited by

          Thanks for your answer TIG, using non modifier keys is indeed a bad idea inside a tool, because they are already bound to lots of different tools.
          I also discovered that the int values corresponding to keystroke can be accesed like this

          valueFor_W_Key = ?W

          a bit weird, but it works.

          I ended up not using keys 😞

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement