简体   繁体   English

如何设置用于切换窗口的Pharo键盘快捷键?

[英]How to set Pharo keyboard shortcut for switching windows?

I have read that in Pharo it's possible to switch between windows using Alt-Tab. 我已经读过在Pharo中可以使用Alt-Tab在窗口之间切换。 But I've never been able to test this, because both OSes I commonly use capture Alt-Tab and use it for their own window switching. 但是我从来没有能够对此进行测试,因为我经常使用的两个OS都捕获Alt-Tab并将其用于它们自己的窗口切换。

I can't find a listing for Alt-Tab in the system Keymap Browser. 我在系统键盘映射浏览器中找不到Alt-Tab的列表。 Where is the key to switch windows defined, and how can I change it? 切换窗口的键在哪里定义,如何更改?

EDIT: I'd also love a "here's how you could have found out for yourself" type answer. 编辑:我也很喜欢“这是您本可以为自己找到的方式”类型的答案。

well... you hit one of our weaker spots :) 好吧...您碰到了我们的弱点之一:)

Keybindings are not in his best shape, but: 键绑定不是处于最佳状态,而是:

  • Actually, alt+tab is already set to "switch window" activity. 实际上,alt + tab已经设置为“切换窗口”活动。 The problem is that does not work all the time (for example, it does not work on Playground). 问题是,它并非一直都有效(例如,它在Playground上不起作用)。
  • This is because there are some hardcoded logic there, who we are removing slowly from the system (some of those parts have more than 15yrs since they come from before Pharo has born). 这是因为那里有一些硬编码的逻辑,我们正在缓慢地从系统中删除这些逻辑(其中一些部件有超过15年的使用寿命,因为它们来自Pharo出生之前)。
  • Someone (probably in a failed attempt to fix the playground, or the hardcodes) forget a halt in the method who creates a new preview window... so even if you reach that part of the system, you will have a debugger. 有人(可能是在尝试修复运动场或硬编码失败时)忘记了创建新预览窗口的方法的暂停...因此,即使到达系统的那一部分,您也将拥有调试器。 Of course, you will be able to restore correct behaviour by just removing the breakpoint, but that will not correct the fact "switch windows" will not be available everywhere. 当然,仅通过删除断点就可以恢复正确的行为,但这不能纠正“开关窗口”将无处不在的事实。
  • I opened a bug entry for it: https://pharo.fogbugz.com/f/cases/15546 , in case you want to follow the issue (you will need an account there, I'm sorry for that). 我为它打开了一个错误条目: https : //pharo.fogbugz.com/f/cases/15546 ,如果您想关注该问题(您将需要一个帐户,很抱歉)。

In any case, we are moving out this hardcode stuff, and you can check all currently available settings going to World Menu/System/Keymap Browser (they are a lot, we are also playing with ideas on how to show better this combinations... emacs style, popup notifications, etc.) 无论如何,我们正在淘汰这种硬编码的东西,您可以检查进入World Menu / System / Keymap Browser的所有当前可用的设置(它们很多,我们还在研究如何更好地显示这种组合的想法。 。emacs样式,弹出通知等)

I got this working by editing the "Basic, general navigation shortcuts among morphs" in package Morhpic-Core>>Kernel edit Morph class>>#morphNavigationShortcutsOn: 通过编辑包Morhpic-Core >>内核编辑Morph类>>#morphNavigationShortcutsOn中的“变形中的基本,通用导航快捷方式”,可以完成此工作:

There you can create shortcuts for "World navigateWindowForward" etc. Took me a while to find keys that worked ok, most don't work well when in a textfield. 在那里,您可以为"World navigateWindowForward"等创建快捷方式。花了我一段时间才能找到可以正常使用的键,大多数键在文本字段中无法正常工作。 I'm using the following: 我正在使用以下内容:

<keymap>
(aBuilder shortcut: #navigateFocusForwardCtrl)
    category: #MorphFocusCtrlNavigation
    default: $j ctrl asKeyCombination
    do: [ :target :morph :event | morph navigateFocusForward ].
(aBuilder shortcut: #navigateFocusBackwardCtrl)
    category: #MorphFocusCtrlNavigation
    default: $k ctrl asKeyCombination
    do: [ :target :morph :event | morph navigateFocusBackward ].
(aBuilder shortcut: #navigateVisibleWindowForward)
    category: #MorphFocusCtrlNavigation
    default: Character tab ctrl asKeyCombination
    do: [ :target :morph :event | World navigateVisibleWindowForward ].
(aBuilder shortcut: #navigateWindowForward)
    category: #MorphFocusCtrlNavigation
    default: $l ctrl asKeyCombination
    do: [ :target :morph :event | World navigateWindowForward ].
(aBuilder shortcut: #navigateWindowBackward)
    category: #MorphFocusCtrlNavigation
    default: $; ctrl asKeyCombination
    do: [ :target :morph :event | World navigateWindowBackward  ]

although the category probably isn't correct, it works... (whereas #MorphFocusNavigation doesn't!) 尽管类别可能不正确,但它可以工作...(而#MorphFocusNavigation则不正确!)

Using the hallo menu bring up an inspector on a window object. 使用hallo菜单可以在窗口对象上显示检查器。 Then in the inspector switch to the 'Keys' tab. 然后在检查器中切换到“键”选项卡。 There you can see all the shortcuts associated with the morph. 在那里,您可以看到与变形关联的所有快捷方式。 Selecting the one that you are interested in (Alt+TAB) will open a new inspector pane to the right. 选择您感兴趣的那个(Alt + TAB),将在右侧打开一个新的检查器窗格。 The 'Source code' shows and highlights the source code where the keybinding is defined. “源代码”显示并突出显示定义了绑定的源代码。 Browse the method, edit it, save it, reset the key mappings (KMRepository reset) and you should be done. 浏览该方法,对其进行编辑,保存,重置键映射(KMRepository重置),您应该已完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM