Domanda

Ho sovrascritto un NSOPENGLVIEW per gestire gli eventi della tastiera. Il rilevamento degli eventi funziona bene, ma ogni volta che premo un tasto che sento e fastidioso suono di urto. Come posso dire alla mia opinione di rilassarmi?

Ecco come appare il mio Keyup: Metodo:

-(void) keyUp:(NSEvent *)theEvent
{
    NSString *characters = [theEvent charactersIgnoringModifiers];

    if ( [characters length] != 1 )
        return;

    unichar keyChar = [characters characterAtIndex:0];

    if ( keyChar == NSLeftArrowFunctionKey ) 
    {
        //do something
        return;
    }

    if ( keyChar == NSRightArrowFunctionKey ) 
    {
        //do something
        return;
    }

    if ( keyChar == NSUpArrowFunctionKey ) 
    {
        //do something
        return;
    }

    if ( keyChar == NSDownArrowFunctionKey ) 
    {
        //do something
        return;
    }
}
È stato utile?

Soluzione

Difficile da dire senza il tuo codice, ma immagino che tu abbia passato l'evento fino a Super anche se lo hai "consumato". Il tono del segnale acustico sta dicendo "Nessuno gestisce questo evento in modo che l'input della tastiera non sia consentito". Se consumi (gestire) l'evento, non passarlo a Super o il sistema presumerà che la tua vista non abbia gestito l'evento.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top