Tab Key being eaten

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 466
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Tab Key being eaten

Post by New Pagodi »

Hi. I saw the ticket you created. Can you try adding,

Code: Select all

#ifdef __WXOSX__
    virtual bool ShouldHandleKeyNavigation(
        const wxKeyEvent &WXUNUSED(event)) const wxOVERRIDE {return false;}
#endif  //__WXOSX__
to stc.h somewhere in the declaration of wxStyledTextCtrl and rebuilding the libraries. It that fixes the problem for you, can you submit this patch:

Code: Select all

diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h
index 36c7c1d900..f723693a6e 100644
--- a/include/wx/stc/stc.h
+++ b/include/wx/stc/stc.h
@@ -5407,6 +5407,13 @@ public:
     void StartStyling(int start, int unused);
 #endif // WXWIN_COMPATIBILITY_3_0
 
+    // Prevent tab navigation on OS X
+    // ---------------------------------------------
+#ifdef __WXOSX__
+    virtual bool ShouldHandleKeyNavigation(
+        const wxKeyEvent &WXUNUSED(event)) const wxOVERRIDE {return false;}
+#endif  //__WXOSX__
+
     static wxVersionInfo GetLibraryVersionInfo();
 
 protected:
diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in
index 7baf51ada4..b14e710524 100644
--- a/src/stc/stc.h.in
+++ b/src/stc/stc.h.in
@@ -530,6 +530,13 @@ public:
     void StartStyling(int start, int unused);
 #endif // WXWIN_COMPATIBILITY_3_0
 
+    // Prevent tab navigation on OS X
+    // ---------------------------------------------
+#ifdef __WXOSX__
+    virtual bool ShouldHandleKeyNavigation(
+        const wxKeyEvent &WXUNUSED(event)) const wxOVERRIDE {return false;}
+#endif  //__WXOSX__
+
     static wxVersionInfo GetLibraryVersionInfo();
 
 protected:
I don't have access to a mac, so I can't test that myself.
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Tab Key being eaten

Post by evstevemd »

New Pagodi wrote:Hi. I saw the ticket you created. Can you try adding,

Code: Select all

#ifdef __WXOSX__
    virtual bool ShouldHandleKeyNavigation(
        const wxKeyEvent &WXUNUSED(event)) const wxOVERRIDE {return false;}
#endif  //__WXOSX__
to stc.h somewhere in the declaration of wxStyledTextCtrl and rebuilding the libraries. It that fixes the problem for you, can you submit this patch:

Code: Select all

diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h
index 36c7c1d900..f723693a6e 100644
--- a/include/wx/stc/stc.h
+++ b/include/wx/stc/stc.h
@@ -5407,6 +5407,13 @@ public:
     void StartStyling(int start, int unused);
 #endif // WXWIN_COMPATIBILITY_3_0
 
+    // Prevent tab navigation on OS X
+    // ---------------------------------------------
+#ifdef __WXOSX__
+    virtual bool ShouldHandleKeyNavigation(
+        const wxKeyEvent &WXUNUSED(event)) const wxOVERRIDE {return false;}
+#endif  //__WXOSX__
+
     static wxVersionInfo GetLibraryVersionInfo();
 
 protected:
diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in
index 7baf51ada4..b14e710524 100644
--- a/src/stc/stc.h.in
+++ b/src/stc/stc.h.in
@@ -530,6 +530,13 @@ public:
     void StartStyling(int start, int unused);
 #endif // WXWIN_COMPATIBILITY_3_0
 
+    // Prevent tab navigation on OS X
+    // ---------------------------------------------
+#ifdef __WXOSX__
+    virtual bool ShouldHandleKeyNavigation(
+        const wxKeyEvent &WXUNUSED(event)) const wxOVERRIDE {return false;}
+#endif  //__WXOSX__
+
     static wxVersionInfo GetLibraryVersionInfo();
 
 protected:
I don't have access to a mac, so I can't test that myself.
I will definitely test and do that!
Thanks a lot
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Tab Key being eaten

Post by evstevemd »

I just tried to apply a patch and here is what I get

Code: Select all

./include/wx/stc/stc.h:5413:18: error: 'ShouldHandleKeyNavigation' marked 'override' but does not override any member functions
    virtual bool ShouldHandleKeyNavigation(
                 ^
In file included from ./src/stc/PlatWX.cpp:46:
./include/wx/stc/stc.h:5413:18: error: 'ShouldHandleKeyNavigation' marked 'override' but does not override any member functions
    virtual bool ShouldHandleKeyNavigation(
                 ^
1 error generated.
make: *** [stcdll_PlatWX.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from ./src/stc/ScintillaWX.cpp:45:
./include/wx/stc/stc.h:5413:18: error: 'ShouldHandleKeyNavigation' marked 'override' but does not override any member functions
    virtual bool ShouldHandleKeyNavigation(
                 ^
1 error generated.
make: *** [stcdll_stc.o] Error 1
1 error generated.
make: *** [stcdll_ScintillaWX.o] Error 1
I will try to remove override and see
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Tab Key being eaten

Post by evstevemd »

And removing override does not work (for obvious reason)
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 466
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Tab Key being eaten

Post by New Pagodi »

Ok, I see now that ShouldHandleKeyNavigation is a member of the implementation member that the window forwards all of its calls to (I was thinking it was a member of wxWindow itself).

So what needs to be done is to derive a new class from wxWidgetCocoaImpl, override ShouldHandleKeyNavigation to make it return false, and set the wxSTC to use that new Impl class instead of the default one. I don't know how to do that last part.
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2408
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: Tab Key being eaten

Post by evstevemd »

New Pagodi wrote:Ok, I see now that ShouldHandleKeyNavigation is a member of the implementation member that the window forwards all of its calls to (I was thinking it was a member of wxWindow itself).

So what needs to be done is to derive a new class from wxWidgetCocoaImpl, override ShouldHandleKeyNavigation to make it return false, and set the wxSTC to use that new Impl class instead of the default one. I don't know how to do that last part.
My knowledge of ObjC/Cocoa is betraying me. It's next to zero :oops:
I hope someone with knowledge on that picks it up!
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Post Reply