Forum

Keyboard delegates
 
Notifications
Clear all

Keyboard delegates

2 Posts
2 Users
0 Reactions
142 Views
(@drbond)
Posts: 10
Eminent Member
Topic starter
 

Has anyone got the keyboard delegates to work, e.g. getting a key press delegate on the form to fire?

 
Posted : 28/06/2024 4:43 pm
(@hackbart)
Posts: 24
Trusted Member
 

Hi i do something like this:

 function doKey(const AEvent: THandle): Boolean;
 begin
  result := PerformKeyPress(AEvent.keyCode);
 end;

asm
   document.addEventListener('keydown', (event) => {
     if (@doKey(event)) {
      event.preventDefault();
     }
    });
  end;

I am aware that this might not be the best way, but can easily hook the keyboard event.

 
Posted : 08/07/2024 5:41 pm
Share: