sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Very difficult key codes!

    Scheduled Pinned Locked Moved Developers' Forum
    10 Posts 4 Posters 624 Views 4 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.
    • M Offline
      macgile
      last edited by

      hello all
      First sorry for my poor English:)

      three days since I am fighting with the shortcut.
      I want to delete the paths in the plugin camerakeymaker with the shortcut ALT + DELETE

      In the MAC OSX (ALT + DELETE) it's available only on onKeyUp and work fine
      on the PC it's available on the onkeyDow AND onkeyup.

      But in the pc it does not work correctly on onkeyup

      onkeyup;
      
              if ((key == VK_DELETE) && ((flags & VK_ALT) == VK_ALT))
               p "OnKeyDown; DELETE PATH"
               ....
              end
      

      When I press (alt + delete) or (delete only) it pass in statement

      do you can help me ???

      best regard

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        @unknownuser said:

        (http://forums.sketchucation.com/viewtopic.php?f)":dwixdyu1]

        I haven't been able to trigger a VK_ALT on either system.

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          I was never able to catch VK_DELETE under Windows...

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            I would say that straightforward simplicity is the lowest form of elegance. 😄

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              @macgile said:

              In the MAC OSX (ALT + DELETE) it's available only on onKeyUp and work fine
              on the PC it's available on the onkeyDow AND onkeyup.

              Here is what I find, under Windows:

              When only Delete is pressed, it triggers only onKeyUp.
              When Shift+ Delete is pressed, it only onKeyUp.
              When Ctrl+ Delete is pressed, it triggers both onKeyDown and onKeyUp.
              When Alt+ Delete is pressed, it triggers both onKeyDown and onKeyUp.

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • M Offline
                macgile
                last edited by

                @thomthom said:

                @macgile said:

                In the MAC OSX (ALT + DELETE) it's available only on onKeyUp and work fine
                on the PC it's available on the onkeyDow AND onkeyup.

                Here is what I find, under Windows:

                When only Delete is pressed, it triggers only onKeyUp.
                When Shift+ Delete is pressed, it only onKeyUp.
                When Ctrl+ Delete is pressed, it triggers both onKeyDown and onKeyUp.
                When Alt+ Delete is pressed, it triggers both onKeyDown and onKeyUp.

                Thank's thomthom

                thank you it is very useful 😄🙂

                1 Reply Last reply Reply Quote 0
                • M Offline
                  macgile
                  last edited by

                  oups

                  fix for mac :
                  K_CTRL_ALT = VK_CONTROL.to_s << VK_ALT.to_s
                  K_ALT_DEL = VK_ALT.to_s << VK_DELETE.to_s

                  onKeyUp
                  #window || mac (on mac, delete it triggers only in onKeyUp)
                  if(@flags == K_ALT_DEL || (@flags + key.to_s) == K_ALT_DEL))

                  do something

                  end

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    macgile
                    last edited by

                    hi Dan Rathbun,

                    first thank's to reply 😄

                    i have found this solution

                    windows :
                    K_CTRL_ALT = COPY_MODIFIER_KEY.to_s << ALT_MODIFIER_KEY.to_s
                    K_ALT_DEL = ALT_MODIFIER_KEY.to_s << VK_DELETE.to_s

                    mac:
                    K_CTRL_ALT = VK_CONTROL.to_s << VK_ALT.to_s
                    K_ALT_DEL = VK_ALT.to_s << VK_DELETE.to_s

                    @flags =""

                    CTRL + ALT or ALT + DEL

                    def onKeyDown(key, repeat, flags, view)

                    SAVE KEY to string

                    @flags += key.to_s
                    end

                    def onKeyUp(key, repeat, flags, view)

                    if (@flags == K_CTRL_ALT)

                    do something

                    end

                    #window or mac (on mac, delete it triggers only in onKeyUp)
                    if(@flags == K_ALT_DEL || (@flags + key.to_s) == K_ALT_DEL))

                    do something

                    end

                    @flags = ""
                    end

                    it's not "très élégant" but it works with any key combination

                    best regard

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      @thomthom said:

                      Here is what I find, under Windows:

                      When only Delete is pressed, it triggers only onKeyUp.
                      When Shift+ Delete is pressed, it only onKeyUp.
                      When Ctrl+ Delete is pressed, it triggers both onKeyDown and onKeyUp.
                      When Alt+ Delete is pressed, it triggers both onKeyDown and onKeyUp.

                      I'm unable to access my mac atm. Anyone able to run this on Mac and check the results? I'm curious if VK_DELETE register on key down under OSX.

                      Thomas Thomassen — SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

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

                        Also note that TAB on MAC only fires with onKeyUp and is ignored otherwise !
                        The TAB key == 9 or 15 or 48 [for PC or MAC or ??]

                        TIG

                        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