1

In Lazarus, I want to programmatically delete a menu item (say under the File menu) during runtime. The user will open the File menu to list all its items, then use the arrow keys to go to a specific (deletable) item, like a recently used file, and press Del key to delete that menu item from the File menu.

How can I capture the event of Del key being pressed while a specific menu item is selected (highlighted) by the user?

Please note that I am coding for both Windows and Linux (GTK2) at the same time. So, I would need a "standard" (Lazarus-way of) solution that will work on both systems: Suggested Windows-related answers are not appropriate in my case.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
FedKad
  • 493
  • 4
  • 19
  • This might help here https://stackoverflow.com/a/49455070/49925 – dummzeuch Feb 04 '23 at 12:56
  • Does this answer your question? [Key press getting lost in menu loop](https://stackoverflow.com/questions/49451207/key-press-getting-lost-in-menu-loop) – Rohit Gupta Feb 04 '23 at 14:11
  • You will most likely not find an answer that works for both platforms as the way menus are handled are very different. So some conditional compilation is in order. The comments above should give you the answer for Windows. – dummzeuch Feb 06 '23 at 09:30

0 Answers0