I have to create a vertical menu using clutter in C. Can anyone help me how to implement focus shift using the navigation keys for the menu where i want to highlight the focused menu option.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
the easiest way is to mark the actor that contains all the menu items as reactive, assign to it the key focus using
clutter_actor_grab_key_focus()and connect to thekey-press-eventsignal. then you can useclutter_event_get_key_symbol()on theClutterEventpassed to the signal and match it agains key symbols likeCLUTTER_KEY_DownorCLUTTER_KEY_Up.then there’s even the possibility to use
ClutterBindingPoolto handle tuples of (key symbol, modifier) and assign them to a specific callback function.for more information, see the API reference:
http://developer.gnome.org/clutter/stable/ClutterActor.html#clutter-actor-grab-key-focus
http://developer.gnome.org/clutter/stable/ClutterActor.html#ClutterActor-key-press-event
http://developer.gnome.org/clutter/stable/clutter-Events.html#clutter-event-get-key-symbol
http://developer.gnome.org/clutter/stable/clutter-Key-Bindings.html
the list of key symbols in in the clutter-keysyms.h header:
http://git.gnome.org/browse/clutter/tree/clutter/clutter-keysyms.h
there are various recipes in the Cookbook as well:
https://developer.gnome.org/clutter-cookbook/stable/events-handling-key-events.html