10-17-2010 12:13 PM - edited 10-17-2010 12:34 PM
Hello, i have a screen like that:
Just don't worry about the incorrect layout: i would like to know, how can i move foccus properly among the buttons? Behavior when i press left and right is not the desired one. I have been looking some posts related and i've only seen that i have to override the moveFocus method, but i just wanted to know if there's any easier way to do it.
Thanks in advance.
Solved! Go to Solution.
10-17-2010 12:29 PM
Overriding moveFocus (both signatures), and perhaps keyChar, in the manager that contains your buttons is the way to go. Writing your own logic allows you exact control over the user interface, and it isn't particularly hard.
10-17-2010 12:31 PM
Thanks for your help, Ted.
What do you mean with bothSignatures and keyChar?
I also know there's some issue with the trackwheel constants, do you know something about that?
10-17-2010 08:18 PM
You should probably override both
int moveFocus(int amount, int status, int time)
void moveFocus(int x, int y, int status, int time)
I don't know about an issue with trackwheel constants. The only thing I can think of is that you are unlikely to run into a trackwheel event, since most devices these days have a 4-way input device (ball or pad).
As to keyChar, several managers trap ENTER or SPACE and react by moving the focus. You might want to do the same thing for those or for shortcut keys.
10-18-2010 12:14 AM
What I believe your trying to achieve is:
For each icon you have a 'predefined' path if the user clicks to the left, right, top, or bottom.
Example. Eventos can either go to noficacinnes or to buscar and nothing else (top and bottom do nothing).
I believe the issue you have is quite simple to solve. If I'm not correct I believe the order in which the icons are being focused on are in the same order of them being added to the manager. If this is true I think you should create an FSM (final state machine) for which determines the users input and moves the focus of the icons. The states are defined as the icons and the 'transition conditions' represent the ability to move focus to another state.
My algorithm to this problem is:
I.) Every event dealing with the optical pad or trackpad, determine the direction.
ii.) Determine which icon is within focus within your Manager
iii.) Cross reference with your FSM to determine if the 'transition condition' holds to move to another icon (new state)
iv.) If the direction is invalid stay the current icon remains in focus or if it is...
Change the state of the FSM to the icon towards that direction and tell your manager(or screen.. can't remember for sure) to move the focus to this icon.
PS Icon can be a button or label field or text field.
Sorry, this is a long read but I believe it'll help you for the situation that I believe your in. If not this is not the desired focus movement or I'm just slightly off or even have questions about the FSM, message me
10-19-2010 06:07 PM
Thank you guys for all your answers, finally i did it overriding the navigationMovement method, controllind dx and dy momvents and the foccused field at every moment. It works perfectly now, as i want.