Browse Source

Minor tweaks to win32, tab key handling.

tags/2021-05-28
jules 13 years ago
parent
commit
6899d2c56f
3 changed files with 18 additions and 5 deletions
  1. +3
    -0
      modules/juce_gui_basics/keyboard/juce_ModifierKeys.h
  2. +3
    -0
      modules/juce_gui_basics/native/juce_win32_Windowing.cpp
  3. +12
    -5
      modules/juce_gui_basics/windows/juce_ComponentPeer.cpp

+ 3
- 0
modules/juce_gui_basics/keyboard/juce_ModifierKeys.h View File

@@ -113,6 +113,9 @@ public:
/** Flags that represent the different keys. */ /** Flags that represent the different keys. */
enum Flags enum Flags
{ {
/** Indicates no modifier keys. */
noModifiers = 0,
/** Shift key flag. */ /** Shift key flag. */
shiftModifier = 1, shiftModifier = 1,


+ 3
- 0
modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -545,6 +545,9 @@ public:
void setTitle (const String& title) void setTitle (const String& title)
{ {
// Unfortunately some ancient bits of win32 mean you can only perform this operation from the message thread.
jassert (MessageManager::getInstance()->isThisTheMessageThread());
SetWindowText (hwnd, title.toWideCharPointer()); SetWindowText (hwnd, title.toWideCharPointer());
} }


+ 12
- 5
modules/juce_gui_basics/windows/juce_ComponentPeer.cpp View File

@@ -184,12 +184,19 @@ bool ComponentPeer::handleKeyPress (const int keyCode,
if (keyWasUsed || deletionChecker == nullptr) if (keyWasUsed || deletionChecker == nullptr)
break; break;
if (keyInfo.isKeyCode (KeyPress::tabKey) && Component::getCurrentlyFocusedComponent() != nullptr)
Component* const currentlyFocused = Component::getCurrentlyFocusedComponent();
if (currentlyFocused != nullptr)
{ {
Component* const currentlyFocused = Component::getCurrentlyFocusedComponent();
currentlyFocused->moveKeyboardFocusToSibling (! keyInfo.getModifiers().isShiftDown());
keyWasUsed = (currentlyFocused != Component::getCurrentlyFocusedComponent());
break;
const bool isTab = (keyInfo == KeyPress (KeyPress::tabKey, ModifierKeys::noModifiers, 0));
const bool isShiftTab = (keyInfo == KeyPress (KeyPress::tabKey, ModifierKeys::shiftModifier, 0));
if (isTab || isShiftTab)
{
currentlyFocused->moveKeyboardFocusToSibling (isTab);
keyWasUsed = (currentlyFocused != Component::getCurrentlyFocusedComponent());
break;
}
} }
target = target->getParentComponent(); target = target->getParentComponent();


Loading…
Cancel
Save