Adding accelerator keys to SmalltalkToolShell

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding accelerator keys to SmalltalkToolShell

Yar Hwee Boon-3
Hi

Is there a way to add accelerator keys to all SmalltalkToolShell  
subclasses eg.

bindings := SmalltalkToolShell acceleratorKeyBindings.
bindings at: 'Shift+Ctrl+B' put: #openClassBrowser.
SmalltalkToolShell acceleratorKeyBindings: bindings.

?

Thanks.

--
Regards
Hwee Boon
MotionObj


Reply | Threaded
Open this post in threaded view
|

Re: Adding accelerator keys to SmalltalkToolShell

Blair McGlashan
"Yar Hwee Boon" <[hidden email]> wrote in message
news:[hidden email]...
> Hi
>
> Is there a way to add accelerator keys to all SmalltalkToolShell
> subclasses eg.
>
> bindings := SmalltalkToolShell acceleratorKeyBindings.
> bindings at: 'Shift+Ctrl+B' put: #openClassBrowser.
> SmalltalkToolShell acceleratorKeyBindings: bindings.

Well you could do it like that, e.g.:

SmalltalkToolShell withAllSubclasses do:
  [:each |
  bindings := each acceleratorKeyBindings.
  bindings at: 'Shift+Ctrl+O' put: #inspectSystemOptions.
  each acceleratorKeyBindings: bindings]

Two things to note:
1) SmalltalkWorkspaceDocument (the class of the workspace windows) is not a
SmalltalkToolShell and neither is the Transcript. Neither actually support
configuraton of accelerator key bindings without code modification anyway.
2) Only newly opened windows will be affected, so its best to do a "Panic"
after the change.

Another approach would be to write an IDE extension. The 'Dolphin IDE
Extension Example' package shows how to do this. It contains only a single
class, OAIDEExtensions. This hooks certain events generated when new tool
windows are opened, and extends the menus in them to include new items. The
'Key Bindings' command on the help menu of all tools (including workspaces,
but not the Transcript) is in fact added by this extension. You could add a
new command to the menu bar with the appropriate accelerator key in the same
way that the extension does, or add key bindings to the accelerator table
directly.

Regards

Blair