Symbian
Symbian OS Library

FAQ-0552 Why do I not get a Mouse_Exited event when I drag the mouse off a component?

[Index][spacer] [Previous] [Next]



 

Classification: Java Category: AWT
Created: 01/04/2001 Modified: 09/24/2001
Number: FAQ-0552
Platform: Not Applicable

Question:
Why do I not get a Mouse_Exited event when I drag the mouse off a Component and a Mouse_Entered event as I enter the parent Container?

Answer:
The posting of Mouse_Entered and Mouse_Exited events in the Symbian Runtime is different from desktop Java implementations on account of real Symbian devices not having a mouse. For instance Quartz DFRD devices use a touch screen and a stylus (pen), whereas Crystal DFRD devices are keyboard driven.

The Quartz emulator (running on a PC) uses the mouse to simulate the pen on the target Quartz DFRD device, with a mouse click simulating the pen tap. The Java runtime implementation on the target hardware is such that if the Component that has just received a pen tap event is different from the Component that produced the previous pen tap event then a Mouse_Exited event is posted for the old Component and a Mouse_Entered event is posted for the new Component. In no other circumstances are these events generated. This may produce unexpected results (compared to other Java runtime environments). For example, in the case of dragging the mouse from one Component to its parent Container (or vice versa) no Mouse_Entered or Exited events are posted.

Unfortunately the earlier ER5 Java emulator behaves differently in that if the mouse drag is started from the parent Container and moved onto the contained Component a Mouse_Exited event is posted by the Container and a Mouse_Entered event is posted by the Component . Whereas if the drag is in the opposite direction no Mouse_Exited/Entered events are posted.

The Quartz Java 6.0 emulator avoids this asymmetry by only posting Mouse_Entered or Mouse_Exited events after the drag has finished and the mouse clicked again (representing a pen tap on the target device). Hence, for the case of dragging from a Component to its parent Container and finishing the drag in the parent Container, a further mouse click will result in a Mouse_Exited event being posted by the Component on which the drag was initiated and a Mouse_Entered event being posted by the parent Container.

The current behaviour is not ideal and we are looking at more appropriate algorithms for generating Mouse_Entered and Mouse_Exited events which will work in the context of both tap and drag. At present we would urge Quartz developers not to rely on handling Mouse_Entered and Mouse_Exited events.