[SOLVED] Keycodes on non-Windows systems lazarus / 31-LCL ---------------------------------------------------------------------- BigChimp · 2012-09-15 07:56 For the SQLDB tutorial I was working on, chris_c gave a helpful hint. He ssuggested using a keyup event handler and catching the delete key, then use that to delete data from a dbgrid. I got it working on Windows: Code: [Select]uses... LCLType .... procedure TForm1.DBGrid1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState   ); begin   // Check for del key being hit and delete the current record in response   if key=VK_DELETE then   begin     // database stuff here   end; end; I vaguely remember though that lcltype is Windows only and one should use another unit for cross-platform compatibility... Am I right? If so, which one and where on the wiki is this documented? If I'm wrong... well, it's been known to happen before Thanks ---------------------------------------------------------------------- codifies · 2012-09-15 08:33 On linux the delete key produces a keyup key of 46 which is the same value as VK_DELETE but it doesnt seem to be defined... obviously we can't rely on the value 46 ..... ---------------------------------------------------------------------- Leledumbo · 2012-09-15 08:41 QuoteI vaguely remember though that lcltype is Windows only and one should use another unit for cross-platform compatibility... Am I right? If so, which one  and where on the wiki is this documented?No, LCLType, LCLIntf and LCLProc is defined with Windows compatibility in mind, but everything there works on all platforms. ---------------------------------------------------------------------- codifies · 2012-09-15 08:46 yeah just found LCLType myself after a bit of digging VK_DELETE does work on Linux! (even if it is a windows key code - but then Delphi did have its roots firmly in windows...) ---------------------------------------------------------------------- BigChimp · 2012-09-15 09:10 Thanks, Leledumbo & Chris (for adding the keycode info to the LCL Key Handling wiki page) That nicely fits with my motto: "If it's not the wiki, it's not documented[1]" [1] Of course, unless it is in the LCL.CHM and FPC pdfs/chms, but well... I'd rather edit the wiki. Much quicker and easier. I added a link to LCL Key Handling in the Multiplatform Programming Guide... ---------------------------------------------------------------------- codifies · 2012-09-15 09:30 damn i was busted  I can't claim it was in the wiki all along now! ---------------------------------------------------------------------- BigChimp · 2012-09-15 09:46 Actually found that wiki page before asking the question... so I was very interested when I saw your name come by on the recently changed wiki page