Re: How to generate event explicit (through code) ?



Thanks David.

This is a requirement of visually challenged person.
Problem statement: To traverse the item present on desktop using single
keystroke.
Details : The existing way provides multiple keystroks in in multiple
directions. This creates confusion of which direction to go and how many
times. There may also be chances to mis few item on desktop/screen.
Proposed solution: provide a traversing mechanism, in which all item can be
visited using single keystroke.


Feel free to discuss, I will look after the suggestions given by you.

regards
Leena


On Mon, Apr 23, 2012 at 6:21 PM, David NeÄas <yeti physics muni cz> wrote:

On Mon, Apr 23, 2012 at 05:16:52PM +0530, Leena Chourey wrote:
I want the focus to move selection/focus from one icon to another
automatically on single key press. I have tried to just run key_press
event
code in a loop, but the selection is not moving from one to another, it
is
directly coming to the last item. it requires a h/w interruption
(key_press) .

As I understood, I need to generate the event key_press explicitly in the
loop every time. How to generate gtk_event explicitly without any (h/w)
key
press?

I must admit that I do not actually understand what you are trying to
achieve (namely why you try to emulate key events).  Anyway:

Common keyboard control is usually defined by bindings, see
GtkBindingSet for start.  Maybe you just need to define bindings for the
required keys to make them move the selection.

If you want something special that does not correspond to the common
movements then register a "key-press-event" callback for the widget and
in that callback run gtk_widget_grab_focus() to move the focus where you
want, gtk_icon_view_select_path() to set the icon view selection, etc.
Return TRUE from the callback (most likely).

You might also want to manipulate the selection/focus by invoking action
signals of the wiget, e.g. the "move-cursor" signal for GtkIconView.

Yeti





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]