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



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]