如何在 Squeak / Morphic GUI 中使用鼠标滚轮
我正在使用 Morphic / Squeak 实现图形用户界面。有些项目具有拖拽功能。删除功能。拖动时,我希望能够使用鼠标滚轮旋转这些项目。
第一个问题是使用鼠标滚轮结束拖动操作并导致放置(尝试)。我怎样才能抑制它 - 并同时触发 mouseWheelEvent ?
第二个问题:如何为我的 Morph 分配鼠标滚轮事件?如上所述,此事件仅在拖动此变形时才相关。(已解决)
I am implementing a graphical user interface with Morphic / Squeak. Some of the items have drag & drop functionality. While dragging, I want to be able to rotate these items with the mousewheel.
The first problem is that using the mousewheel ends the drag-action and leads to a drop (attempt). How can I suppress that - and fire the mouseWheelEvent at the same time?
The second problem: How can I assign a mousewheel-event to my Morph? As mentioned above, this event only is relevant while dragging this Morph. (solved)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
似乎在选择支持它的 VM 实现上,Squeak 将鼠标滚轮映射到 Ctrl 向上箭头 和 Ctrl-向下箭头 键事件。例如,在 Win32 上 sqWin32Window.c:
这就是您在 Squeak 中需要使用的内容。 (如果您使用的是 Polymorph 扩展,则有一个特殊的
mouseWheel
事件,但它们所做的只是过滤 Ctrl-Up 和 Ctrl-Down 并生成“假”MouseWheelEvent< /code> 消息。)
查看
HandMorph
中handleEvent
的一些代码:Polymorph
MouseWheelEvent
是 MouseEvent 的子类,它不返回 true 到isMove
,因此你会得到一个掉落。如果你想让它起作用,你必须在这里改变一些东西。Appears that on VM implementations that have chosen to support it, Squeak maps the mouse wheel to Ctrl Up-Arrow and Ctrl-Down-Arrow key events. For instance, on Win32 in sqWin32Window.c:
So that's pretty much what you've got to work with inside Squeak. (If you're using the Polymorph extensions, there is a special
mouseWheel
event, but all they're doing is filtering Ctrl-Up and Ctrl-Down and generating a "fake"MouseWheelEvent
message.)Looking at a bit of code for
handleEvent
inHandMorph
:The Polymorph
MouseWheelEvent
is a subclass of MouseEvent that doesn't return true toisMove
, hence you get a drop. You'll have to change something here if you want this to work.最好的选择是找到一个能够执行您想要的操作的变形,然后浏览它的方法以了解它是如何做到的。话虽如此,我还没有遇到过任何支持滚轮特定功能的鼠标,当然原始的施乐鼠标也没有这样的功能。
Your best bet is to find a morph that does something like what you want and then browse its methods to see how it does it. Having said that, I haven't come across any that support wheel-specific functions, and of course the original Xerox mouse had no such feature.