JUCE GUI Users: How do you handle the on screen keyboard?


#1

Hi Everyone,

I've been trying to incorporate some JUCE text editors into my application and it suddenly dawned on me that if they are on the lower half of the screen I can't see what I'm typing, since the keyboard covers the editor itself.

My current idea is to put my main component into a viewport and increase its height and scroll the viewport to ensure that the text editor is in view. Obviously, to get this working well I need to access the height of the keyboard which I'm doing by adding:

In juce_ios_windowing, in the applicationDidFinishLaunching

    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
    [center addObserver:self selector:@selector(keyboardOnScreen:) name:UIKeyboardDidShowNotification object:nil];
    [center addObserver:self selector:@selector(keyboardOffScreen:) name:UIKeyboardDidHideNotification object:nil];

And then hooking these into the Desktop class, using a listener for keyboard on screen to notify other classes.

It seems to work fine at the moment, but obviously isn't the best solution as it involves altering a number of the JUCE library files, so I was wondering if anybody had experience with this and what their solution was?


Thanks