[PATCH] Fix: Up/Down keys change focus on Mac/Carbon
Original Reporter info from Mantis: s.kopf
-
Reporter name: Stefan Kopf
Original Reporter info from Mantis: s.kopf
- Reporter name: Stefan Kopf
Description:
On Mac/Carbon:
The Up and Down arrow keys change the focus to the previous or next Control instead of changing the selection of the currently focused ListBox.
Analysis:
In TApplication.DoArrowKey(), a LM_GETDLGCODE message is sent to the current control to test if the control wants to handle the Up and Down arrow by itself or if it should be used to change the focus.
On Windows, this message is dispatched to the DefaultWndProc, which responds properly with DLGC_WANTARROWS. But outside Windows, there is no DefaultDlgProc.
This Fix:
There is a similar problem with the Tab, Arrow and Return keys in TMemo. This is handled there by implementing a WMGetDlgCode() procedure.
This patch implements a similar method for TCustomListBox which returns DLGC_WANTARROWS.
Steps to reproduce:
On Mac / Carbon:
- Add multiple TListBoxes to a Form in the designer
- Add some lines to each ListBox
- Run it
- Click in each ListBox and mark the first item
- Click in first ListBox so that it gets the focus
- Press the Down Arrow
Expected:
The second item in the first ListBox is now the selected item
However:
The focus changes to the second ListBox and the selection of the second ListBox is moved to the second item.
Mantis conversion info:
- Mantis ID: 30558
- Platform: Mac
- Version: 1.6
- Fixed in revision: r54592 (#d58a9c4b)
- Monitored by: » d3rit (Derit Agustin)