Re: vw7.7 & keyboard shortcuts

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

Re: vw7.7 & keyboard shortcuts

Steven Kelly

What would you like Ctrl+B to do? (Or a better example, Ctrl+U, which isn’t mapped in the Workspace or Browser in 7.6 or 7.7.)

 

The understanding of VW is that Ctrl+[A-Z] is a normal character, and so it will insert it. That’s this line in UIFeelPolicy>>keyboardDispatchTable

                k defaultForCharacters: #normalCharacterKey:.

 

If you don’t want Ctrl+[A-Z] to be treated as insertable characters, try adding something like this in the next line:

                (((1 to: 26) copyWithout: 13 "CR") copyWithout: 11 "Compose key") do: [:ix |

                                k bindValue: #ignoreInputKey: to: (Character value: ix)].

 

Steve

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Mark Plas
Sent: 11 February 2010 12:37
To: Josef Springer
Cc: VWDEV list
Subject: RE: vw7.7 & keyboard shortcuts

 

Hi Josef,

 

I don't think it's locale related. The problem is that an input field first answers 'no' to the question whether it can handle Ctrl-B, and a bit later is asked to handle it anyway and just inserts a 'Ctrl-B character' in the input field.

 

It should insert nothing at all.

 

I use ctrl-B as an example, but any ctrl-<key> combination will result in this if it cannot be handled by an input field and cannot be handled by the menu bar.

 

I'm not sure I understand your remark concerning the keyboardHook. The possible issue I see is that it runs a risk of not getting evaluated if there is a menu item in the menu bar that can handle the keyboard shortcut. This is not what I would expect, given that the keyboard event handling algorithm was changed to give priority to the widget first and only thereafter to the menu bar.

 

Mark

 

From: Josef Springer [mailto:[hidden email]]
Sent: donderdag 11 februari 2010 11:09
To: Mark Plas
Cc: VWDEV list
Subject: Re: vw7.7 & keyboard shortcuts

 

Hi Mark,

some ideas:
We have ported our application OfficeTalk, a Business-Process-Management Suite, to 7.7. Your described mechanism works right (with keyboadhooks too). But you may take respect to some special chars in a deployment system. e.g. Ctrl-b will start the debugger for example. A second possible reason is, if you get black rectangles, your current locale may not match the conditions.

Josef Springer

Mark Plas wrote:

Hello,

 

I'm trying to upgrade from vw7.4.1 to vw7.7.

 

In vw7.7 the handling of keyboard events has changed a bit and I'm attempting to change our code to conform to this new way.

 

The way vw7.7 handles keyboard events can be seen in KeyboardProcessor>>processKeyboardEvent: and can be described like this:

First the 'currentConsumer' is asked to handle a keypress/release and if he can handle it, he's told to handle it.

Next, if the 'currentConsumer' says he cannot handle it, the menubar is asked to handle it.

Lastly, If the menubar can't handle it, the currentConsumer again comes into play and is told to handle the event without asking whether he wants to.

 

This causes some problems in our application. When, for instance,  I press ctrl-B in an input field, a black rectangle appears. The reason for this can be seen by going through the algorithm above:

 

First the input field is asked whether it can handle ctrl-B. It answers false because ctrl-B is not mapped in its dispatch table.

Next the menubar is asked whether it can handle ctrl-B. It answers false because I have no menu items with a ctrl-B shortcut.

Lastly, the input field is told to handle ctrl-B. This time, it doesn't check whether ctrl-B is in the dispatch table, so it just inserts a 'ctrl-B' character in the input field, which gets displayed as a black rectangle.

 

How can I avoid this?

 

Something else which is not clear to me is how the #keyboardHook on a TextEditorController gets taken into consideration.

Suppose I have an input field with a keyboardHook that can handle Ctrl-B and suppose I also have a menu item that can handle ctrl-B, then, if we go through the algorithm again, this happens:

 

First the input field is asked whether it can handle ctrl-B. It answers false because ctrl-B is not mapped in its dispatch table. Even though the keyboardHook can handle it, it's not asked to handle it.

Next the menubar is asked whether it can handle ctrl-B. It answers true and handles the Ctrl-B.

The input field is no longer told to handle the keyboard event because the menubar took care of it.

 

Result: my input field didn't get the chance to handle Ctrl-B, which I wouldn't expect given that the keyboardEvent handling algorithm was changed to give priority to the currentConsumer.

 

How do I avoid the black rectangles and is it normal that the keyboardHook on an input field doesn't come into play?

 

Thanks,

Mark


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: vw7.7 & keyboard shortcuts

Mark Plas

Hi Steven,

 

We have our own keyboardDispatchTable for our application and I want Ctrl+B to do nothing (actually, ctrl-<almostAnyKey> should do nothing).

 

In the past we added a line like you suggested to map all Ctrl-key combinations to #ignoreInputKey:, and this used to work fine because in vw7.4.1 first the menu bar was given the chance to handle Ctrl-<key> and in case no Ctrl-<key> menu item existed, the current input field got the Ctrl-<key> and this was mapped to do nothing.

 

This worked fine.

 

But in VW7.7 this technique doesn't work anymore, because when I now map all Ctrl-<key> combinations to #ignoreInputKey:, then the InputField thinks that it wants to handle the keyboard shortcut – since there is a mapping for it in its dispatchTable – and doesn't let the menu bar handle it anymore. So all of a sudden I can no longer use any Ctrl-key shortcut combination to perform menu actions when an input field has keyboard focus because the input field eats all Ctrl-key presses. Which is not what I want.

 

So I decided to NOT map the Ctrl-<key> combinations in the dispatchTable. This way the inputfield doesn't mistakenly think that it should handle the keyboard event, and my menu items can still be performed using the Ctrl-<key> combination. Only problem then is that when there is no menu item handling the shortcut, the inputfield is forced to handle it anyway resulting in unwanted behavior and a black rectangle in the inputfield.

 

How can I get around this (without changing base code)?

 

Mark

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Steven Kelly
Sent: donderdag 11 februari 2010 12:10
To: vwnc NC
Subject: Re: [vwnc] vw7.7 & keyboard shortcuts

 

What would you like Ctrl+B to do? (Or a better example, Ctrl+U, which isn’t mapped in the Workspace or Browser in 7.6 or 7.7.)

 

The understanding of VW is that Ctrl+[A-Z] is a normal character, and so it will insert it. That’s this line in UIFeelPolicy>>keyboardDispatchTable

                k defaultForCharacters: #normalCharacterKey:.

 

If you don’t want Ctrl+[A-Z] to be treated as insertable characters, try adding something like this in the next line:

                (((1 to: 26) copyWithout: 13 "CR") copyWithout: 11 "Compose key") do: [:ix |

                                k bindValue: #ignoreInputKey: to: (Character value: ix)].

 

Steve

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Mark Plas
Sent: 11 February 2010 12:37
To: Josef Springer
Cc: VWDEV list
Subject: RE: vw7.7 & keyboard shortcuts

 

Hi Josef,

 

I don't think it's locale related. The problem is that an input field first answers 'no' to the question whether it can handle Ctrl-B, and a bit later is asked to handle it anyway and just inserts a 'Ctrl-B character' in the input field.

 

It should insert nothing at all.

 

I use ctrl-B as an example, but any ctrl-<key> combination will result in this if it cannot be handled by an input field and cannot be handled by the menu bar.

 

I'm not sure I understand your remark concerning the keyboardHook. The possible issue I see is that it runs a risk of not getting evaluated if there is a menu item in the menu bar that can handle the keyboard shortcut. This is not what I would expect, given that the keyboard event handling algorithm was changed to give priority to the widget first and only thereafter to the menu bar.

 

Mark

 

From: Josef Springer [mailto:[hidden email]]
Sent: donderdag 11 februari 2010 11:09
To: Mark Plas
Cc: VWDEV list
Subject: Re: vw7.7 & keyboard shortcuts

 

Hi Mark,

some ideas:
We have ported our application OfficeTalk, a Business-Process-Management Suite, to 7.7. Your described mechanism works right (with keyboadhooks too). But you may take respect to some special chars in a deployment system. e.g. Ctrl-b will start the debugger for example. A second possible reason is, if you get black rectangles, your current locale may not match the conditions.

Josef Springer

Mark Plas wrote:

Hello,

 

I'm trying to upgrade from vw7.4.1 to vw7.7.

 

In vw7.7 the handling of keyboard events has changed a bit and I'm attempting to change our code to conform to this new way.

 

The way vw7.7 handles keyboard events can be seen in KeyboardProcessor>>processKeyboardEvent: and can be described like this:

First the 'currentConsumer' is asked to handle a keypress/release and if he can handle it, he's told to handle it.

Next, if the 'currentConsumer' says he cannot handle it, the menubar is asked to handle it.

Lastly, If the menubar can't handle it, the currentConsumer again comes into play and is told to handle the event without asking whether he wants to.

 

This causes some problems in our application. When, for instance,  I press ctrl-B in an input field, a black rectangle appears. The reason for this can be seen by going through the algorithm above:

 

First the input field is asked whether it can handle ctrl-B. It answers false because ctrl-B is not mapped in its dispatch table.

Next the menubar is asked whether it can handle ctrl-B. It answers false because I have no menu items with a ctrl-B shortcut.

Lastly, the input field is told to handle ctrl-B. This time, it doesn't check whether ctrl-B is in the dispatch table, so it just inserts a 'ctrl-B' character in the input field, which gets displayed as a black rectangle.

 

How can I avoid this?

 

Something else which is not clear to me is how the #keyboardHook on a TextEditorController gets taken into consideration.

Suppose I have an input field with a keyboardHook that can handle Ctrl-B and suppose I also have a menu item that can handle ctrl-B, then, if we go through the algorithm again, this happens:

 

First the input field is asked whether it can handle ctrl-B. It answers false because ctrl-B is not mapped in its dispatch table. Even though the keyboardHook can handle it, it's not asked to handle it.

Next the menubar is asked whether it can handle ctrl-B. It answers true and handles the Ctrl-B.

The input field is no longer told to handle the keyboard event because the menubar took care of it.

 

Result: my input field didn't get the chance to handle Ctrl-B, which I wouldn't expect given that the keyboardEvent handling algorithm was changed to give priority to the currentConsumer.

 

How do I avoid the black rectangles and is it normal that the keyboardHook on an input field doesn't come into play?

 

Thanks,

Mark


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc