Set the EditClear MenuItem’s KeyboardShortCut key (Delete)

On MY Windows 8.1 laptop, I just tested an application who holds (in App.Open Event):

#If TargetCocoa EditClear.KeyboardShortCut = "BACKSPACE" // Chr(8) #Else EditClear.KeyboardShortCut = "DELETE" // Chr(127) #EndIf

Thank you to the original code poster.

But, this does not enable the key that is known under the name “Delete” key (the key that delete the character at the left of the cursor in a Text Editor, the Key have a left arrow on its caps <—), but instead the other one (Supp. in French: the key that delete the character at the right of the cursor in a Text editor).

So, to be able to get an action in the large “Delete” key, I had to use:

EditClear.KeyboardShortCut = "BACKSPACE"

To the Linux gurus:

What is the situation on Linux ?

In fact, I think that I will delete those lines and simply add “Backspace” in the MenuEditor for the EditClear MenuItem.

After this finding, I can say:
Delete: the small key (top-right key in MY Akoya laptop)
Backspace: the large key usually called “Delete”…, the key with a left arrow (<—)

Same situation on OS X and Windows.

Warning: in the Menu Editor, Windows display (running OS X IDE), for “Backspace”, I get beside the Delete key: Ctrl+Bsp (no, it’s an error, the MenuModifier is set to true each time one set something in the Key field).
OS X Keyboard shortcut: the delete key logo
Windows Keyboard shortcut: Bsp

Working environment:
Xojo 2014r4
Yosemite 10.10.4 (pb)
Windows 8.1 “current”

Apple calls Delete the ‘delete on the left’ ? key, which Windows and Linux both call BackSpace, like ISO/IEC 9995 does.

On both Windows and Linux, as well as 3270 and 5250 terminals, for instance, the ‘delete to the right’ key is called Delete. Apple sometimes calls the equivalent fn-Delete key “Forward Delete”.

[quote=189373:@Emile Schwarz]After this finding, I can say:
Delete: the small key (top-right key in MY Akoya laptop)
Backspace: the large key usually called “Delete”…, the key with a left arrow (<—)[/quote]

What Apple calls Delete is in fact BackSpace for everything else.

OK Michel, thank you for the history.

This does nothing to the fact that in code, to fire what we think is the Delete key, we only have to put Backspace in the Key field and uncheck the Alternate Key (added automatically by Xoho IDE).

Apple sometimes calls the equivalent fn-Delete key “Forward Delete”.
On Apple’s Laptop, to fire the Function keys (F1 to F12) one have to use fn-. Else the pressed key will change the screen light, keyboard light, sound, etc.

[quote=189486:@Emile Schwarz]OK Michel, thank you for the history.

This does nothing to the fact that in code, to fire what we think is the Delete key, we only have to put Backspace in the Key field and uncheck the Alternate Key (added automatically by Xoho IDE).[/quote]

Xojo is cross platform, remember ? In Xojo, “Delete” (keycode 75) means ‘delete on the right’ and “Backspace” (keycode 33) means ‘delete on the left’. Whatever is written on the Apple keyboard. It is simple, really. You are confused because you think in Apple terminology instead of using Xojo terminology. For Windows and PC users, which means two out of three platforms (plus Web Edition), this is quite logical.

[quote=189486:@Emile Schwarz]>Apple sometimes calls the equivalent fn-Delete key “Forward Delete”.
On Apple’s Laptop, to fire the Function keys (F1 to F12) one have to use fn-. Else the pressed key will change the screen light, keyboard light, sound, etc.[/quote]

You can select either behavior in the Keyboard Preferences, by checking or not the box “Use all F1, F2, etc. keys as standard function keys” and just below, is explained : “When this option is selected, press the Fn key to use the special features printed on each key”.

[quote=189373:@Emile Schwarz]On MY Windows 8.1 laptop, I just tested an application who holds (in App.Open Event):

#If TargetCocoa
EditClear.KeyboardShortCut = “BACKSPACE” // Chr(8)
#Else
EditClear.KeyboardShortCut = “DELETE” // Chr(127)
#EndIf

Thank you to the original code poster.

But, this does not enable the key that is known under the name “Delete” key [/quote]

try
EditClear.KeyboardShortCut = “DEL” // Chr(127)

Backspace works fine for both OS X (Yosemite) and Windows 8.1.

Thank you…

You use KeyCodes ? Good luck !

I prefer Chr(8) or Chr(127): far more reliable if you want to see your code running on multi keyboards with different layouts… !

[quote=189627:@Emile Schwarz]You use KeyCodes ? Good luck !

I prefer Chr(8) or Chr(127): far more reliable if you want to see your code running on multi keyboards with different layouts… ![/quote]

I referred to keycodes as they represent the actual reference to a key in Xojo. Not what they generate. And thank you for your wish, I am indeed lucky enough to be able to use key codes or keydown Key string according to be best possible use for a given project. Nothing ever in programming should be limited to one aspect only