Recent

Author Topic: Changing focus with the arrow keys – a better algorithm is needed  (Read 990 times)

furious programming

  • Hero Member
  • *****
  • Posts: 786
I am bringing this topic up for two reasons. Firstly, because the Lazarus designer has a rather poor algorithm for finding a new control to focus when an arrow key is pressed. It works, but very often it selects the controls that are not closest to the given direction, and some of them cannot be reached at all, no matter how hard you try. And secondly, because I am looking for the best algorithm that will meet exactly the same assumption as changing the focus in the designer. So you can kill two birds with one stone here.

So, does anyone have a better idea for an algorithm that finds which controls to focus on, based on the position/size of the one currently selected and the four possible search directions (arrow keys)?
Lazarus 2.2.6 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2025 (±10 years).

 

TinyPortal © 2005-2018