Author Topic: Shift-Tab got broken :(  (Read 10883 times)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Shift-Tab got broken :(
« on: May 29, 2005, 12:08:51 am »
What happened? Yesterday it worked just fine for unindenting blocks.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Shift-Tab got broken :(
« Reply #1 on: May 29, 2005, 12:22:51 am »
I mentioned it in another thread. It 's intercepted by the notebook now. We 'll have to come up with a solution...

Yiannis.
Be patient!
This bug will be fixed soon...

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Shift-Tab got broken :(
« Reply #2 on: May 29, 2005, 12:51:13 am »
So basically it's just a matter of the wxStyledTextControl getting the keyboard event because the notebook gets it first?

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Shift-Tab got broken :(
« Reply #3 on: May 29, 2005, 02:52:33 am »
I found some info about it!
http://lists.wxwidgets.org/archive/wx-dev/msg30909.html

Quote
Bugs item #690274, was opened at 2003-02-20 12:53
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=109863&aid=690274&group_id=9863

Category: Generic
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Shift-TAB events can't be seen by controls

Initial Comment:
Controls on a window having the
wxTAB_TRAVERSAL style
that wanting to process Shift-TAB events can't do
so; they don't even get a KeyDown for the tab part
of the Shift-tab (though they do see the "shift".  
This is not consistent with the event handling
model that says that events start at the control
level and then work their way up the chain.  

Robin Dunn wrote in response to this problem:
  "The only way to get around it I know of is to not
   have a parent (or other ancestor) window with the
   wxTAB_TRAVERSAL style set,  but then you'd have
   to handle all of the tab traversal yourself.

   You may want to bring this up on wx-dev and/or
   enter a bug report about it, but I doubt that
   anything will be done in the short term (before
   2.5) because it would take major surgery to make
   any changes there."

So anyway, here's the bug report.
/Will Sadkin
Parlance Corporation

----
And then at SF:

Quote
Date: 2003-11-04 09:46
Sender: robind
Logged In: YES
user_id=53955

Probably related to this: If a window has wxWANTS_CHARS
style, it still can not receive KEY or CHAR events for
Shift-Tab.  For example, wxStyledTextCtrl uses wxWANTS_CHARS
but if it is in a container window and other controls are
present Shift-Tab always goes back to the other controls.

====================

So I think that a possible workaround is make cbEditor (which is a subclass of wxPanel) process the events, and if it gets a shift-tab, send it to the control... IF AND ONLY IF the control has wxWANTS_CHARS style.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Shift-Tab got broken :(
« Reply #4 on: May 29, 2005, 04:40:47 am »
FIXED IT! :D

This was a hard one! :? . Using the control's ProcessEvent wouldn't work since the wxwidgets "shift-tab eating bug" occurs at this function. So I had to dig into the STC source code (Thank GOD for Open Source!) and found what I was looking for: wxStyledTextCtrl's SendMsg function (2328 is backtab).

The rest was just a matter of adding Shift-Tab to the accelerator keys (main.cpp). Ta-da!