I am working on a UI in FLTK, and my basic problem boils down to this:
I have a bunch of widgets on a main Window (input, output, button widgets). Say, 16 items (4rows x 4 coloumns). I need to navigate between the widgets using the arrow keys.
Mainly, if focus is on (r4, c4) (the bottom right corner widget) :
a right arrow press should shift focus to (r1, c1) (top left corner widget).
a left arrow press should shift focus to (r4, c3).
an up arrow press should shift focus to (r3, c4).
a down arrow press should shift focus to (r1, c4).
i.e. navigation should work quite intuitively, according to what we are used to.
By default, while using the arrow (or Tab) keys, the focus changes between the widgets in the order they were created. Up and right always go to next widget (in order of creation) and down and left always go to previous widget (in order of creation).
Is there any way to do this in FLTK? Or do I need to create an algorithm to do this?