当光标移出SWT外壳时,将其丢弃 [英] Dispose of SWT shell when cursor moves out of it
问题描述
我正在为Eclipse插件实现自定义预览/工具提示。它使用SWT中的Shell进行了此操作,删除了所有修饰,并在其中放置了一个文本框。看起来不错。但是,现在当光标移出外壳窗口时我需要处理外壳,并且遇到了一些问题:
I'm implementing a custom preview/tooltip for an Eclipse plug-in. It did it using a Shell in SWT, removing all its trimmings and placing a text box inside it. It looks great. However now I need to dispose of the shell when the cursor moves out of the shell window and I ran into some issues:
将mousemoveListener附加到贝壳?首先,我这样做了,但是后来我意识到,该侦听器仅捕获发生在外壳内部的鼠标移动事件。我该如何捕获从外壳中脱出的鼠标,以便将其丢弃?
Does it make sense to attach a mousemoveListener to the shell? First I was doing this but then I realized that this listener only captures mouse move Events which occur inside the shell. How will I capture the mouse going out of the shell so as I could dispose of it?
感谢您,
Krt_Malta
Thanks and regards, Krt_Malta
推荐答案
附加 MouseTrackListener 与 MouseTrackAdapter 作为侦听器并覆盖 mouseExit()方法。
Attach a MouseTrackListener with MouseTrackAdapter as a listener and override mouseExit() method.
这篇关于当光标移出SWT外壳时,将其丢弃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!