Author Topic: Home and End keys do not work in (popup) menus  (Read 372 times)

CM630

  • Hero Member
  • *****
  • Posts: 1772
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Home and End keys do not work in (popup) menus
« on: August 03, 2026, 08:37:29 am »
Just today I found that the Home and End keys do not work in Lazarus menus in Windows 11, I have not tried in other OSes or previous Windows versions.
Maybe something is wrong with Windows, because these keys do not work in its own Notepad.exe. :o
Is there a way to make these keys work?

I tried this code, the Home and End keys are shown on the right as shortcuts, but they do not work. Besides that, even if they worked it would be wrong, because Home and End should move the selection to top/bottom without executing the selected lines.


Code: Pascal  [Select][+][-]
  1. uses
  2. ...lcltype...
  3.  
  4. procedure TForm1.PopupMenu1Popup(Sender:TObject);
  5. var
  6.   i: integer = 0;
  7. begin
  8.   if (PopupMenu1.Items.Count < 3) then exit;
  9.   for i:= 1 to PopupMenu1.Items.Count -2 do
  10.     PopupMenu1.Items[i].ShortCut := scNone;
  11.   PopupMenu1.Items[0].ShortCut := VK_HOME;
  12.   PopupMenu1.Items[PopupMenu1.Items.Count - 1].ShortCut := VK_END;
  13. end;  
« Last Edit: August 03, 2026, 08:41:41 am by CM630 »
Лазар 4,8 32 bit (sometimes 64 bit); FPC3,2,2

Bart

  • Hero Member
  • *****
  • Posts: 5757
    • Bart en Mariska's Webstek
Re: Home and End keys do not work in (popup) menus
« Reply #1 on: August 03, 2026, 11:50:10 am »
Tried an app I built with Lazarus 1.9.0/fpc 3.0.4: issue already present.

Bart

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12641
  • Debugger - SynEdit - and more
    • wiki
Re: Home and End keys do not work in (popup) menus
« Reply #2 on: August 03, 2026, 12:32:43 pm »
Window-Explorer (file explorer) - popup menu also does not react to it.
So this simply seems how Windows works.

Bart

  • Hero Member
  • *****
  • Posts: 5757
    • Bart en Mariska's Webstek
Re: Home and End keys do not work in (popup) menus
« Reply #3 on: August 03, 2026, 05:55:35 pm »
Window-Explorer (file explorer) - popup menu also does not react to it.
So this simply seems how Windows works.

Same with e.g. Notepad.
I tend to agree with Martin here.

Bart

jamie

  • Hero Member
  • *****
  • Posts: 7902
Re: Home and End keys do not work in (popup) menus
« Reply #4 on: August 04, 2026, 12:51:13 am »
I've noticed on my windows 11 laptop that some keys don't work as expected unless I use the special FN-Shift key.

Don't know if that helps.

Jamie
The only true wisdom is knowing you know nothing

CM630

  • Hero Member
  • *****
  • Posts: 1772
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Home and End keys do not work in (popup) menus
« Reply #5 on: August 04, 2026, 02:05:51 pm »
Window-Explorer (file explorer) - popup menu also does not react to it.
So this simply seems how Windows works.
Still I do not know how to make these work. TPopuMenu and TMainMenu have no OnKey* properties.
So I guess the only solution is a custom menu component?

pg_up and pg_down keys work neither.
Btw, in MS word Home and End goto to the top/bottom of the sections of the menu  :o
Лазар 4,8 32 bit (sometimes 64 bit); FPC3,2,2

Bart

  • Hero Member
  • *****
  • Posts: 5757
    • Bart en Mariska's Webstek
Re: Home and End keys do not work in (popup) menus
« Reply #6 on: August 04, 2026, 06:00:41 pm »
The apps on my machine (Win11) where this does work all seem to have non-standard menu's.
So yes, you may have to implement this yourself.

Bart

 

TinyPortal © 2005-2018