Blackberry Storm Emulator - eventi TouchGesture non sparare, come ottenere un colpo al lavoro?
-
19-09-2019 - |
Domanda
giocato con la tempesta emulatore e il 4.7 JDE, per la vita di me non riesco a capire come generare eventi gesto nell'emulatore.
Di seguito è riportato il codice evento di tocco per l'applicazione di esempio RIM EmbeddedMapDemo. Sembra abbastanza semplice, ma touchGesture.getEvent () == TouchGesture.SWIPE non sembra mai registrati per vero.
Come posso registrare colpi nell'emulatore? Con il mio mouse provo facendo sinistro del mouse e trascinare, ma che non sembra funzionare.
/**
* @see Field#touchEvent(TouchEvent)
*/
protected boolean touchEvent(TouchEvent message)
{
boolean isConsumed = false;
if(_mapField.isClicked())
{
TouchGesture touchGesture = message.getGesture();
if (touchGesture != null)
{
// If the user has performed a swipe gesture we will
// move the map accordingly.
if (touchGesture.getEvent() == TouchGesture.SWIPE)
{
// Retrieve the swipe magnitude so we know how
// far to move the map.
int magnitude = touchGesture.getSwipeMagnitude();
// Move the map in the direction of the swipe.
switch(touchGesture.getSwipeDirection())
{
case TouchGesture.SWIPE_NORTH:
_mapField.move(0, - magnitude);
break;
case TouchGesture.SWIPE_SOUTH:
_mapField.move(0, magnitude);
break;
case TouchGesture.SWIPE_EAST:
_mapField.move(- magnitude, 0);
break;
case TouchGesture.SWIPE_WEST:
_mapField.move(magnitude, 0);
break;
}
// We've consumed the touch event.
isConsumed = true;
}
}
}
return isConsumed;
}
Soluzione
Premendo il tasto sinistro del mouse simula cliccando in basso sullo schermo ... il simulatore (ed anche un dispositivo di tempesta vera e propria, credo) non generare eventi TouchGesture mentre stai cliccando in basso sullo schermo.
Che cosa si vuole fare è tenere premuto il tasto destro del mouse e trascinare, dal momento che il tasto destro del mouse simula un tocco dello schermo, senza scatto. In questo modo, si dovrebbe essere in grado di ottenere TouchGestures al fuoco.
E 'un po' difficile da fare un gesto sul simulatore, è un po muoversi velocemente, ma se si utilizza il tasto destro del mouse si dovrebbe essere in grado di farlo.