Limited use macro or hotkey

I need a shortcut limited to a specific window (Xojo form), I want to have a cmd-R shortcut that will fill in a default value in the text of textfield.

I haven’t been able to find how to do this

Thanks,

Does this Window / Form have its own Menubar? (common on Windows, less so on Mac)

The easiest / most correct way to do so would be to have a Menu Item with Cmd-R as the Shortcut. The Window would then have a Menu Handler for the item that would do your pre-filling.

I did read that as an option but the window just has the system wide menu bar. and I am on a Mac Desktop.

You could add the item to the App-wide Menubar, but then you’ll want to make sure it’s disabled when not contextually relevant.

You could also give the Window a specific Menubar, that’s not against the rules, but Mac users are keen to notice the Menubar changing.

Is there something about this approach that doesn’t work for you?.

Warning: Command-R is used…
Finder: Rotate to the right the selected image(s)
Finder: with Shift… acivate AirDrop.
Firefox: Reload the current document (current Tab).

I do not seek elsewhere.

NB: of course, it can be difficult to find an unused shortcut. BUT: to Paste data, Il will use Command-Shift-V (Other possible uses Command-Option-V and Command-Control-V and Shift can be used too…)

Now, it is your software, and you may know better than me what to do.

You can disable and hide that MenuItem in the MenuBarSelected Event on other types of windows, and enable it in the MenuBarSelected Event for that specific window. This way it only shows (and works) when that type of window is in front.

The HIG Apple wrote years ago recommend that top-level Menubar items should not disappear and reappear, but rather enable and disable. This helps the user experience as it keeps the items discoverable, even when they’re not contextually relevant. Contextual menus should be only the contextually relevant items as you suggest, though.

I’m just guessing the workflow of Bill’s app, and this is an opinion, but I think a Window-specific Menubar might actually be the right approach for this situation.

1 Like

The window specific menu bar seems to be the way to make it work

thanks

Have a look at the AppleMenu when you press the Option Key (become System Information) and release it (it come back to About This Mac).