On Tue, Mar 19, 2013 at 6:05 PM, Damien Pollet <[hidden email]> wrote:
Not easy I think... The problem is that VM does not raise events for every key pressed.. And those that does not work are for example ctrl, cmd, shift... Try modifying the following method:
signalEvent: eventBuffer "Signal the event buffer to all registered event handlers. Handlers need make sure to copy the buffer or extract the data otherwise, as the buffer will be reused."
--> Transcript show: eventBuffer asString;cr. self eventHandlers do: [:handler |
handler handleEvent: eventBuffer] Add the remarked line, open a transcript and press ctrl alone. It is impossible to know right now if ctrl is being pressed or not by itself :(.
|
Ups, it should have been
InputEventFetcher>>signalEvent: eventBuffer
... ... .. .
On Tue, Mar 19, 2013 at 6:50 PM, Guillermo Polito <[hidden email]> wrote:
|
In reply to this post by Guillermo Polito
I am currently looking at some keyboard code in the VM with my iOS
bluetooth keyboard experiment. We can grab a lot of things on the image side (for example, left and right shifts are different etc). KEY_DOWN, KEY_CHAR, KEY_UP can be passed. But the code does basic things at the moment and can for sure be made more extended. But then to do that, maybe a bit more platform specific. Which may not be what one wants. Once I got hold of the details in my keyboard management code (now dealing with arrows, braces, etc), keymapping are my next area of investigation as for navigating Pharo on an iPad, being hable to do a lot with the external keyboard is very useful. Phil 2013/3/19 Guillermo Polito <[hidden email]>: > > On Tue, Mar 19, 2013 at 6:05 PM, Damien Pollet <[hidden email]> > wrote: >> >> On 18 March 2013 21:45, Guillermo Polito <[hidden email]> >> wrote: >>> >>> - Keymappings 101 tuto in blog (for 2.0, cause in 3.0 the api coould >>> change a bit :) >> >> >> I just read your post… question: is it possible to define semi-modal >> sequences? > > > Not easy I think... The problem is that VM does not raise events for every > key pressed.. And those that does not work are for example ctrl, cmd, > shift... Try modifying the following method: > > signalEvent: eventBuffer > "Signal the event buffer to all registered event handlers. > Handlers need make sure to copy the buffer or extract the data otherwise, as > the buffer will be reused." > --> Transcript show: eventBuffer asString;cr. > self eventHandlers do: [:handler | > handler handleEvent: eventBuffer] > > Add the remarked line, open a transcript and press ctrl alone. > > It is impossible to know right now if ctrl is being pressed or not by itself > :(. > >> >> Let me explain: modes are (hidden) states in the system that influence how >> it interprets inputs. Typical example is capslock: depending on its state, >> pressing the A key will give you a or A. >> >> Having too many or unclear modes is bad, because you have to track their >> state in your mind, or take a specific action to know which mode you're in. >> In contrast, a semi-mode is when you need continuous physical action to >> maintain it; typical example is the modifier keys like shift alt ctrl… >> Semi-modes are a much better compromise (ideally there would be no modes >> anywhere, but that's not very realistic in practice). >> >> To get back to my point, a semi-modal sequence would be: >> >> ($a asShortcut, $b asShortcut) ctrl "[press ctrl] a b [release ctrl]" >> >> as opposed to: >> $a asShortcut ctrl, $b asShortcut ctrl "maybe release ctrl in the middle" >> >> where if you press ctrl-a and get interrupted, you're going to be confused >> when ctrl-b does not do what it's supposed to do as a standalone shortcut… >> if you're an emacs user, think ctrl-G, if you're a vim user, think spurious >> i's in your files… >> >> >> -- >> Damien Pollet >> type less, do more [ | ] http://people.untyped.org/damien.pollet > > |
Free forum by Nabble | Edit this page |