0

I have created win32 program that uses the shortcut 'Insert' a lot. Now I am converting the program to Mac. I find that there is no default 'Ins' key on the keyboard. But on further investigation I find that u can use the combination of fn+return.

Now Delphi does not catch the combination of these keys. But only the key events of the 'Return', the 'fn' is lost. But i have read that the 'fn' key changes the key send from the keyboard instead of sending a combination.

Is there a possibility to catch it when a user presses 'fn + return'.

Community
  • 1
  • 1
r_j
  • 1,348
  • 15
  • 35
  • What if the keyboard has no fn key? – David Heffernan Nov 24 '15 at 15:46
  • It is still a shortcut. So there are always other ways to get to the functionality. I just want to keep my shortcuts the same for mac and windows. And I cannot change the windows shortcuts because of legacy users. – r_j Nov 24 '15 at 16:15
  • 2
    It might be more prudent to offer a different shortcut for Mac users in this case, so that they can access it without that key – David Heffernan Nov 24 '15 at 16:21
  • 1
    +1 to what David said. What is the closest, most intuitive Mac equivalent to the 'Ins' key? Then do a preprocessor check in your program for Macs, examples here http://stackoverflow.com/questions/1529031/what-c-preprocessor-conditional-should-i-use-for-os-x-specific-code . – Anthony Burg Nov 24 '15 at 17:48
  • That's the C++ flavor of Delphi, so the Objective Pascal equivalent to that. – Anthony Burg Nov 24 '15 at 17:51
  • I use a Mac keyboard all the time, and I, too, would do what David says: offer a different, Mac-like shortcut. I don't know for what the `Ins` key is used in your Windows program, but I would look for a Mac alternative. E.g., In the Delphi IDE editor on the Mac, Ctrl+V toggles between insert and override mode, just like usually `Ins` does. Note that in that setup, copy is Cmd+V, not Ctrl+V. – Rudy Velthuis Nov 24 '15 at 18:41
  • FWIW, there is no need to change the Windows shortcuts. Just add appropriate shortcuts for the Mac. Windows does not have a Cmd key, so use that for key combinations. – Rudy Velthuis Nov 24 '15 at 18:44
  • Cmd is the Win key on a Windows keyboard. So it is probably better to only add those shortcuts on the Mac. – Sebastian Z Nov 24 '15 at 18:53
  • Thnx for all the advice guys – r_j Nov 25 '15 at 07:44

1 Answers1

3

Fn+Enter will return KEY_PADENTER, but that will be translated by FMX to a simple return. You'd have to use RegisterKeyMapping / UnregisterKeyMapping in order to reassign that. But I hope you've already learnt from the comments that Fn+Enter is probably not a good idea for the Mac. So don't annoy your users with Windows shortcuts. Instead of telling them that they have to press Fn+Enter you could just as well tell them to use another shortcut.

Another trick is that the MacBook keyboard doesn't have a Delete key, so most Mac applications often use Backspace instead of Delete for the hotkeys. It is just faster than pressing the replacement Fn+Backspace. Also Mac users expect the Cmd key instead of Ctrl for most shortcuts.

Sebastian Z
  • 4,520
  • 1
  • 15
  • 30