Key Events in wxDataViewCtrl
Key Events in wxDataViewCtrl
I found a strange behaviour: When using a wxDataViewCtrl and I hit CTRL+F then a little text bar opens which looks like a search bar. Entering text there does not filter and I didn't find anything in the API that would handle this. I don't know if it's the OS or WindowManager (I'm on Debian9 Gnome).
Now the strange part: I cannot catch any EVT_KEY or CHAR(_HOOK) events with that control. They're only caught when I've clicked on a column before. That is, when I click in the table part then any keyboard input opens the said search bar.
Can anyone tell me what this text field is or how I can stop it from appearing in order to implement my own search text field?
This does not happen with a wxDataViewListCtrl. When subclassing that I could catch the events normally and react to them.
Now the strange part: I cannot catch any EVT_KEY or CHAR(_HOOK) events with that control. They're only caught when I've clicked on a column before. That is, when I click in the table part then any keyboard input opens the said search bar.
Can anyone tell me what this text field is or how I can stop it from appearing in order to implement my own search text field?
This does not happen with a wxDataViewListCtrl. When subclassing that I could catch the events normally and react to them.
Re: Key Events in wxDataViewCtrl
I don't think the search bar comes from wxWidgets, i guess it's a feature of the underlying native control.
How did you bind them? Can you try a wxAcceleratorTable?I cannot catch any EVT_KEY or CHAR(_HOOK) events with that control.
This is a big mistery to me, as wxDataViewListCtrl only wraps a different API around wxDataViewCtrl . This shouldn't have any effect on key event handling.This does not happen with a wxDataViewListCtrl. When subclassing that I could catch the events normally and react to them.
Use the source, Luke!
Re: Key Events in wxDataViewCtrl
I bound the event listener statically and dynamically, same result.
I didn't know about the wxAcceleratorTable. I used it but the "default" text field still opens.
What event does it produce though? wxEVT_MENU?
I didn't know about the wxAcceleratorTable. I used it but the "default" text field still opens.
What event does it produce though? wxEVT_MENU?
Re: Key Events in wxDataViewCtrl
Did you Bind it to the control itself (which you must do) or the frame (which won't work)?I bound the event listener statically and dynamically, same result.
Yes.I didn't know about the wxAcceleratorTable. I used it but the "default" text field still opens.
What event does it produce though? wxEVT_MENU?
Use the source, Luke!
Re: Key Events in wxDataViewCtrl
I bound the control itself. In the constructor since I'm subclassing the wxDataViewCtrl.
I used a static EVT_MENU binding to check if the event raised by the wxAcceleratorTable are processed. The handler function was not called.
I used a static EVT_MENU binding to check if the event raised by the wxAcceleratorTable are processed. The handler function was not called.
Re: Key Events in wxDataViewCtrl
Sorry, then i'm out of ideas. And as i work exclusively under Windows, i can't test this myself.
BTW: Does the search bar also appear in the "dataview" sample that comes with wxWidgets?
BTW: Does the search bar also appear in the "dataview" sample that comes with wxWidgets?
Use the source, Luke!
Re: Key Events in wxDataViewCtrl
The exact same behaviour also occurs in the sample. Also that this search bar does not appear in the wxDataViewListCtrl/TreeCtrl.
I've searched the web a little and also tested it in other native linux applications (such as rhythmbox). Same behaviour except for that rhythmbox handles the ctrl+f combination.
Now, it seems to be a GTK "feature". Which can be disabled in code:
According to some posts
disables the search bar when the user starts typing
and
with column=-1 disables the entire search (and thus the ctrl+f)
https://developer.gnome.org/gtk3/stable ... rch-column
I thought about doing something like this:
but the functions are unkown unless I include <gtk-3.0/gtk/gtk.h>
(compiler flags: `pkg-config --cflags gtk+-3.0` linker flags:`pkg-config --libs gtk+-3.0`)
But then my programme doesn't compile anymore (among other erroes like this):
I've searched the web a little and also tested it in other native linux applications (such as rhythmbox). Same behaviour except for that rhythmbox handles the ctrl+f combination.
Now, it seems to be a GTK "feature". Which can be disabled in code:
According to some posts
Code: Select all
gboolean gtk_tree_view_get_disable_search (GtkTreeView *tree_view);
and
Code: Select all
void gtk_tree_view_set_search_column (GtkTreeView *tree_view, gint column);
https://developer.gnome.org/gtk3/stable ... rch-column
I thought about doing something like this:
Code: Select all
gtk_tree_view_get_disable_search(GTK_TREE_VIEW(GtkGetTreeView()));
gtk_tree_view_set_search_column(GTK_TREE_VIEW(GtkGetTreeView()),-1);
(compiler flags: `pkg-config --cflags gtk+-3.0` linker flags:`pkg-config --libs gtk+-3.0`)
But then my programme doesn't compile anymore (among other erroes like this):
I guess it's because of circular inclusion or something? wxWidgets includes or defines some GTK stuff somewhere I suppose. Is it possible to use both together so I can use GTK functions?In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:30:0,
from /usr/include/gtk-3.0/gdk/gdk.h:32,
from /usr/include/gtk-3.0/gtk/gtk.h:30,
from /home/Foo/Netbeans/C++/List/DataView.cpp:13:
/usr/include/gtk-3.0/gdk/gdktypes.h:93:39: error: conflicting declaration ‘typedef cairo_rectangle_int_t GdkRectangle’
Re: Key Events in wxDataViewCtrl
Are you actually using GTK3? The default for wxWidgets is GTK2. In any case, it's important that you use the exact same header files that were used for building wxWidgets itself.but the functions are unkown unless I include <gtk-3.0/gtk/gtk.h>
The GTK implementation of wxDVC includes these files:
Code: Select all
#include <gtk/gtk.h>
#include "wx/gtk/private.h"
#include "wx/gtk/private/event.h"
#include "wx/gtk/private/gdkconv.h"
#include "wx/gtk/private/gtk2-compat.h"
#include "wx/gtk/private/list.h"
Use the source, Luke!
Re: Key Events in wxDataViewCtrl
I upgraded to Debian 10, installed the gtk3-dev package again and it worked. The search bar still appears though. But now the wxAcceleratorTable works and I just used another key combination (ctrl+f is still swallowed). That's good enough for now.