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

    Default constants

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 3 Posters 364 Views 3 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.
    • thomthomT Offline
      thomthom
      last edited by

      When listing Object.constants I find these constants in the results:

      MK_ALT MK_COMMAND MK_CONTROL MK_LBUTTON MK_MBUTTON MK_RBUTTON MK_SHIFT MK_ALT

      But I see no reference in the manual to them. Are they added by a plugin? How can I find out what is SU constants and what is plugin constants?

      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

        @thomthom said:

        ... I see no reference in the manual to them. Are they added by a plugin? How can I find out what is SU constants and what is plugin constants?

        I can't find the reference now.. but I 'think' these were added by Google when they fixed the onMButtonDown and onMButtonUp callbacks (Tool Class) in SU 7.0 ... but the constants I 'think' are meant to be used with Tool.onKeyDown and Tool.onKeyUp.
        ie:
        def onKeyDown(key, repeat, flags, view) %(#F0F0F0)[__]if key = MK_LBUTTON %(#F0F0F0)[____]if flags = MK_ALT %(#F0F0F0)[______]# do something special %(#F0F0F0)[____]else %(#F0F0F0)[______]# do normal pick %(#F0F0F0)[____]end %(#F0F0F0)[__]end end

        My brain 'thinks' I read it in a non-official mention, perhaps an offhand remark in the forums by a Google SUTM.

        I'm not here much anymore.

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

          @thomthom said:

          How can I find out what is SU constants and what is plugin constants?

          It's easy.

          (1) Make a COPY of the Sketchup folder and subfolders (EXCEPT Plugins)
          Call it "Google Sketchup 7 Nude" (or similar)
          (2) Make an empty 'Plugins' folder, under the "nude" copy.
          (3) Either create an NEW user account (or use your Administrator account)
          (4) Switch to the other account (Log off if you wish, or not.)
          (5) On the other account, make a shortcut to to the "Nude" Sketchup.
          Don't run the "Nude" Sketchup on your 'normal' account as it will change the settings in your 'normal' Registry Hive!!!
          (6) Run 'Nude' Sketchup on the New (or other account). Check Prference Settings for those things in the 'Tools' folder so that they are at minimum (probably DC only.)

          Now you have a way to check what comes with the base API, by switching users and running the 'Nude version.'

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            I made a list of SU and some Ruby constants here:

            http://code.google.com/p/skx/wiki/Constants#Key_Constants

            Not sure about the MK_ constants. For keys, I always guessed VK_ (virtual key?) were to be used.

            There are MF_ constants dealing with menu items, so maybe they are menu-related, but I'm not sure what they'd be used for. Can you determine if a menu item is clicked while the Ctrl key is down, for example?

            Hi

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

              No - no way to get Ctrl/Shift/Alt for menu items.

              I think the MF is used for key events.

              For modifiers on mouse down/up events I found these to be the best choice:
              * ALT_MODIFIER_MASK
              * ALT_MODIFIER_KEY

              * CONSTRAIN_MODIFIER_MASK
              * CONSTRAIN_MODIFIER_KEY 
              
              * COPY_MODIFIER_MASK
              * COPY_MODIFIER_KEY 
              

              Though, it seems that to check the flags for the key presses the *_MASK is the ones you should use. On OSX they appear to be all the same, but on PC the _MASK and _KEY is different. And the values returned differs from PC and OSX.

              Wish the manual would clarify this instead of just throwing them out there...

              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

                from Windows SDK, WinUser.h, line 2373...
                [language=C]:
                *` %(#008B8B)[/

                • Key State Masks for Mouse Messages
                  /
                  #define MK_LBUTTON 0x0001
                  #define MK_RBUTTON 0x0002
                  #define MK_SHIFT 0x0004
                  #define MK_CONTROL 0x0008
                  #define MK_MBUTTON 0x0010
                  #if(_WIN32_WINNT >= 0x0500)
                  #define MK_XBUTTON1 0x0020
                  #define MK_XBUTTON2 0x0040
                  #endif /
                  _WIN32_WINNT >= 0x0500 /]`*

                I'm not here much anymore.

                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