I am trying to add 'key-press-event' to a treeview. This is to detect the "Delete" key, and then I can remove an item from the list. In order to do that I have added the following signal:
g_signal_connect(G_OBJECT(_treeView),
"key-press-event",
G_CALLBACK(on_list_keypress),
0);
The callback function "on_list_keypress" is called when I press any button. However after adding this signal I am not able to navigate through the messages using the arrow, home and end keys.
I have replaced g_signal_connect with g_signal_connect_after, and now I can use the keyboard to navigate through messages and detect any key press when an item in the list is selected.
After adding the handler for the Delete key, now when I press the Delete button it deletes the item from the list. However, I also hear a beep sound from the speakers (in my case pc case speaker) as if the key is not valid.
I was wondering if there is any way to prevent the beep sound when I press the delete button?
Note: if I use g_signal_connect, and press the Delete button there is no beep sound. But that disables the default keyboard shortcuts for the treeview (such as arrow up, down etc...)
Thank you