Mohammadreza Rezaei
Mohammadreza Rezaei

Reputation: 33

gtk+ c simulating tab key from code

I'm trying to build a Gtk C GUI application and I can't use the mouse or keyboard for it. My input device is an external keypad connected to the application with serial port.

My problem is that I want to switch between some GtkButtons in my form when a key on my keypad is pressed (like when using the Tab key in a GUI applications).

Here's what I tried so far:

      GTK_WIDGET_GET_CLASS(widget)->move_focus(widget,GTK_DIR_TAB_FORWARD);

But the problem is that the focus is not visible until I actually press the Tab key on my keyboard. When I run the application, it seems as if nothing is happening, but when I press Tab once, I see that focus is changing.

What am I doing wrong?

Upvotes: 1

Views: 455

Answers (1)

M.Shah
M.Shah

Reputation: 111

make sure that GtkWindow is TOP LEVEL type , because for top level window you can access widgets within that window using keyboard TAB key without doing any addition in code for using TAB. Post your code for more accurate solution.

Upvotes: 2

Related Questions