VCB Problem on MAC OS

In Windows, if we press and hold the “x” key, it shows on VCB just once but in MAC OS it shows on VCB repeatedly as long as we hole key. How can we stop repeating the key in MAC OS SU VCB when we hold it?
Thank you in advance for your help.

But, on Windows if you press and hold a key on a numerical key area (any key like 0…9, + - * / etc. )
image
it will recognized as repeated keystroke on VCB too!

In some reason in Windows this repeat behavior on “main part” of keyboard is ignored by SU.
Unlike on Mac OS. As far as I know, on Mac, SU will recognize this repeat behavior.

My best answer is to tell the user to hit - and not hold for a long time - the key on Mac. :wink:

BTW. (.Not closely related to the topic, but related to inconsistently handling of key repetition …)
Both method:
onKeyUp (key, repeat, flags, view)
onKeyDown (key, repeat, flags, view)
contains a repeat parameter.

For onKeyDown, It’s okay that as long as I hold down the key it can be considered a repetition.

But, for onKeyUp I don’t really understand what the idea was for the key I hit - I will keep it up repeatedly. or what… :thinking: :blush: :confounded:

Dear Dezmo, I used the press and hold “x” key as a purpose in my extension. I used the “X” key in Windows and the “ALT” key in MAC OS. Please have a look on Youtube.

(I heve been warned you in your “Key Numbers on MAC OS” topic… about the shortcut keys.)

That means I can not use your extension properly since I associated the “X” key to start Axes tool.

image

Therefor when I push the “X” during using you extension, MAJ Followme will be terminated and the Axes tool will start.

…is much better idea to use on both platform. :innocent:

2 Likes

I have set up ‘X’ to X-ray View, Mac and Windows!
When doing an array, I always start with the number…

2 Likes

Also, I use Number + “X” in one of my extensions. Use X is the same in MAC and Windows just asci code for “x” and “X” (88 and 120) are opposit.

For sure Great Dezmo doesn’t need my extensions. :blush:

2 Likes

I would not use X as a modifier key. X is a valid shortcut key as Mike and Dezmo has pointed out, and doesn’t “belong” to the active tool. Ctrl, Shift and Alt are the modifier keys SketchUp tool typically use.

Slightly unrelated, but even after watching the video I don’t really know what X does. I’d recommend a more descriptive status text that says what each modifier key does, just as for the native tools. Also you don’t need to bring up in the status text that a length can be written to the VCB; that’s implicit from the VCB being enabled.

My extension is a follow-me tool. In this extension, the face follows your mouse pointer freely. So normally you don’t need a path the same as SU follow-me. So typically you move your mouse to a point and click on it. If you have a curve and want the extension to follow the curve you have to click on each point of the curve and it is a bit takes time. For solving this problem, the user can press and hold the “x” key and just move the mouse cursor over the curve. Curve point automatically adds to follow-me points. This video comes after another video about my extension. It is the reason the video is meaningless for you. Sorry for it. In Windows, I cannot use “Shift” because users normally use it for the pan. I cannot use “ALT” because windows use it to switch between programs. I cannot remember now but also “Control” has a problem to use also. In windows, I can use a few letters same as “x” and also the “Tab” key. In Mac, my only chance is “ALT”.

…Unless you try to follow my advise in your other topic: “ Key Numbers on MAC OS

In #onKeyDown , and #onKeyUp :
Return true to prevent SketchUp from processing the event.

1 Like

And during that (when you using Orbit tool) your tool is suspended and waiting to get resumed

I don’t think so.

1 Like

I cannot understand it.

      def onKeyUp(key, repeat, flags, view)
        @x_key = 0 if @win && key == 88
        @x_key = 0 if @win && key == 120
        @x_key = 0 if !@win && key == VK_ALT
        return true # Is it right?
      end

Would you please explain more?

I’ve used Ctrl, Shift and Alt in numerous custom Ruby tools myself and it works perfectly fine.

As Dezmo says, when using alt you have to return true to prevent the Menu from being activated.

2 Likes

You can try something like this.

def onKeyUp(key, repeat, flags, view)
  @follow_edge = false if key == VK_ALT

  # Prevent  menu focus when pressing Alt
  key == VK_ALT
end

Also, telling what the key does helps the user using the tool.

Sketchup.set_status_text("Click to add a corner. Alt = Follow edge.")
2 Likes

It works very well. Thank you so much. Now I can use “ALT” in both windows and MAC.

2 Likes

You are right. In MAC “control” key acts the same as “ALT” in windows and it was the reason I didn’t use it before but now I can. Thanks again.

1 Like

On Mac the copy modifier isn’t Ctrl but Command. If you rely on VK_COPY rather than VK_CTRL it will work “consistently” across platform.

2 Likes