Toolbar DblClick or Cmd Key

using the native toolbar (OSX for now) is there a way to detect the command key is depressed when a toolbutton is clicked?

I tried putting this in the toolbutton action event and it seems to ignore it

if Keyboard.AsyncCommandKey then msgbox "Cmd Key"

What I want to do is have a toolbar button the when the user clicks it normally… the function is active for ONE shot. If they dblclick/cmd key then it stays available until they purposely turn it off.

As far as I know this is only possible - not only in Xojo but also in AppKit - by replacing the standard behavior of an NSToolbarItem with:

- (void)setView:(NSView *)view

The subview can be any NSControl (though some obviously don’t make sense in a toolbar). An NSView is an NSResponder and thus can react to any keyboard and mouse input. You then need to subclass the control in the Objective C Runtime and redirect the overridden methods (like mouseDown: or keyDown:) to Xojo (check macoslib to learn how this is done should you not know that already).

Btw, I’ve also successfully used setView: with Xojo’s BevelButton, Popup and Combobox to replace the standard NSToolbarItem. For example I use BevelButtons to have a Finder like toolbar.

So the answer is simply… NO

Obj-C is not x-platform… which I guess Ishould have been more clear about… “OSX for now”… infering Windows coming soon

There is no other way, since - as I wrote - not even AppKit supports this on their NSToolbarItems.