KeyPress::tabKey

Hi Jules,

I can’t figure-out how to get tab-key working properly on Mac under Juce, and am puzzled that there aren’t other reports on the forums about this… well weird! :slight_smile:

Basically, I can’t use the tab key to move focus around on the Macs [but this works fine on the Windows boxes]. As a simple example, I have some text components in a container. If I set a breakpoint in

bool TextEditor::keyPressed (const KeyPress& key)
{
...
    else if (key.getTextCharacter() != 0
              && (! isReadOnly())
              && (tabKeyUsed || ! key.isKeyCode (KeyPress::tabKey)))

    {

}

I find that the key code when pressing the tab key is “9” and this fails to match against KeyPress::tabKey which has a value of “113”. So either the tab key press is generating the wrong value, or the KeyPress::tabKey value is mis-assigned. Very strange!

Same basic problem doing shift-tab (where we’d expect focus to move the other way…)

This is true on intel and PowerPC macs, with a variety of keyboards.

I hope you can help. :slight_smile:

Thanks in advance,

Pete

This sounds like a bug that crept in for a short time recently until I realised I’d messed-up, and fixed it. Have you tried the tip?

Hi Jules, sounds great - haven’t got the tip for a few weeks - how stable is it at the moment? :slight_smile:

Pete

Now would be a good time to grab it…

I hear you! Getting it now…

Hi Jules,

Getting this problem when rebuilding my apps on Windows… have rebuilt Juce and rebuilt the application:

1>myFile.obj : error LNK2001: unresolved external symbol "public: static class juce::File const __cdecl juce::File::getSpecialLocation(enum juce::File::SpecialLocationType)" (?getSpecialLocation@File@juce@@SA?BV12@W4SpecialLocationType@12@@Z)

Any ideas?!

I see that comparing old with new, I get this:

juce_File.h:

  • static const File getSpecialLocation (const SpecialLocationType type);
  • static const File JUCE_CALLTYPE getSpecialLocation (const SpecialLocationType type);

juce_File.cpp:
… no corresponding change in prototype!

Have you maybe forgotten to check-in a change to juce_File.cpp?

Pete

Sorry, just saw this in juce_win32_files.cpp … which looks right. puzzled

const File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType type)
{
...

Arrghh… I hadn’t rebuilt properly, linker problem now gone. Sorry to have wasted your time with that linker issue! :frowning:

Hi Jules,

Just to report that the tip of SVN fixed the problem with tab-navigation on the Mac. Many thanks!!

Pete

I bump cause an impossibility to use tab…
For instance in a KeyPress::keyPressed :[quote] if(key == KeyPress(KeyPress::tabKey))
{
flipToNetExplorer();
return true;
}
if(key == KeyPress(KeyPress::returnKey)) {
m_addButton->triggerClick();
return true;
}[/quote]

return is usable, tab is not.

Is the presence in the component of a TextPropertyComponent problematic ?

Thanks.

What happens is that when a comp is focused, and you press tab, then if the focus successfully moves to another component, then the tab key is thrown away… If nothing happens (e.g. if none of the components want focus or if their createFocusTraverser() returns 0), then the tab key is allowed through as a normal keypress.

A bit complicated, I’m afraid!