Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] StyledText and keyboard actions

Hello Thomas,

I've never worked with styled text or remapped keys, but at glance I noticed  the "keyActionMap" variable.
There is a getKeyBinding(int) and setKeyBinding(int,int) method.

The createKeyBindings() method initializes all default keybindings (which is called from the constructor).

I haven't experiment with it, but you could perhaps override the default mappings. Like if you look inot the createKyBindings() method:
setKeyBinding(SWT.ARROW_UP, ST.LINE_UP);  <<< set these to some of your own.

I don't know if this is what you need or if the above works thou? Is that of any use?

If someone knows of a better approach, please feel free to post.

Regards

Leo




On Thu, Feb 2, 2017 at 7:38 AM, Thomas Singer <ts-swt@xxxxxxxxxxx> wrote:
Hi,

Currently we are using an ugly hack to modify the behavior of some default shortcuts and add own shortcuts in a StyledText by having a subclass of StyledText inside org.eclipse.swt.custom and overriding the method invokeAction(int actionId).

For example, we can cut/copy without selection or limit cursor-left/-right to the very line, have a more advanced delete-previous or Mac-like handling of cursor-up/-down.

What is the designed way of
- replacing default shortcuts with own ones and
- add new shortcuts?

Thanks in advance.

--
Best regards,
Thomas Singer
=============
syntevo GmbH
http://www.syntevo.com
http://www.syntevo.com/blog
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev



--
Leo Ufimtsev
Software Engineer, Eclipse team.
Toronto, Canada

Red Hat, Inc.
Leonidas@xxxxxxxxxx | http://DeveloperBlog.RedHat.com/

Back to the top