SPEC: accept by Tab ?

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

SPEC: accept by Tab ?

Hartmut Krasemann-2
Hi,

maybe someone can give me a hint.
I use SPEC for an elaborate GUI with the need to switch autoaccept of inputFields off.
So accept of textInputFields is by Return.

Since Tabs are used to navigate anyway, It would be great to "accept" on leaving the inputField.

I found the possibility to bind a key/keyCombination to an action
(as is done in ButtonModel initialize:
self bindKeyCombination: Character space toAction: [ self action ]    )

However the following code in a TextinputFieldModel
   textinputField   bindKeyCombination: Character tab toAction:  textinputField acceptBlock
did not work.

What should I do?

Thanks for a hint

--
signatur

Hartmut Krasemann
Königsberger Str. 41 c
D 22869 Schenefeld
Tel. 040.8307097
Mobil 0171.6451283
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: SPEC: accept by Tab ?

Stephane Ducasse-3
Hi harmunt

I'm doing too many things to get energy to be concentrated on Spec.
Now I'm surprised that Character space would work as a KeyCombination

and I saw that the eventKeyStrokes are often converted into a keyCombination
for the next previous event.


registerKeyStrokesForNextFor: aWidget

aWidget ifNil: [ ^ self ].
self eventKeyStrokesForNextFocus do: [:each |
aWidget bindKeyCombination: each toAction: [ self giveFocusToNextFrom: self ] ]

eventKeyStrokesForNextFocus
"String describing the keystroke to perform to jump to the next widget"
^ { Character tab asKeyCombination }


Can you try 
  textinputField   bindKeyCombination: Character tab asKeyCombination toAction:  textinputField acceptBlock


Tx



On Sat, May 6, 2017 at 10:22 PM, Hartmut Krasemann <[hidden email]> wrote:
Hi,

maybe someone can give me a hint.
I use SPEC for an elaborate GUI with the need to switch autoaccept of inputFields off.
So accept of textInputFields is by Return.

Since Tabs are used to navigate anyway, It would be great to "accept" on leaving the inputField.

I found the possibility to bind a key/keyCombination to an action
(as is done in ButtonModel initialize:
self bindKeyCombination: Character space toAction: [ self action ]    )

However the following code in a TextinputFieldModel
   textinputField   bindKeyCombination: Character tab toAction:  textinputField acceptBlock
did not work.

What should I do?

Thanks for a hint

--

Hartmut Krasemann
Königsberger Str. 41 c
D 22869 Schenefeld
Tel. 040.8307097
Mobil 0171.6451283
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: SPEC: accept by Tab ?

Hartmut Krasemann-2

The error I made: textinputField acceptBlock does not work.
the action seems to take a morph. The following worked for me.
textinputField
    bindKeyCombination: Character tab
    toAction: [:morph| "hereTheAcceptBlockContent." textInputField text: morph text].
But this is ugly.

I use a spec with 5 TextinputFields.
with or without "asKeyCombination" the additionalKeyBindings only sometimes work,
ie. on some of the fields in a spec, but not all (this was even dynamically changing).
In those cases where the additional binding of the tab works, the navigation fails.

It seems that the tab is consumed either by navigation or the additional keyBinding.
And which one is decided by chance.
So this will not help me.

Any  idea?



Am 07.05.17 um 09:34 schrieb Stephane Ducasse:
Hi harmunt

I'm doing too many things to get energy to be concentrated on Spec.
Now I'm surprised that Character space would work as a KeyCombination

and I saw that the eventKeyStrokes are often converted into a keyCombination
for the next previous event.


registerKeyStrokesForNextFor: aWidget

aWidget ifNil: [ ^ self ].
self eventKeyStrokesForNextFocus do: [:each |
aWidget bindKeyCombination: each toAction: [ self giveFocusToNextFrom: self ] ]

eventKeyStrokesForNextFocus
"String describing the keystroke to perform to jump to the next widget"
^ { Character tab asKeyCombination }


Can you try 
  textinputField   bindKeyCombination: Character tab asKeyCombination toAction:  textinputField acceptBlock


Tx



On Sat, May 6, 2017 at 10:22 PM, Hartmut Krasemann <[hidden email]> wrote:
Hi,

maybe someone can give me a hint.
I use SPEC for an elaborate GUI with the need to switch autoaccept of inputFields off.
So accept of textInputFields is by Return.

Since Tabs are used to navigate anyway, It would be great to "accept" on leaving the inputField.

I found the possibility to bind a key/keyCombination to an action
(as is done in ButtonModel initialize:
self bindKeyCombination: Character space toAction: [ self action ]    )

However the following code in a TextinputFieldModel
   textinputField   bindKeyCombination: Character tab toAction:  textinputField acceptBlock
did not work.

What should I do?

Thanks for a hint

--

Hartmut Krasemann
Königsberger Str. 41 c
D 22869 Schenefeld
Tel. 040.8307097
Mobil 0171.6451283
[hidden email]




--
signatur

Hartmut Krasemann
Königsberger Str. 41 c
D 22869 Schenefeld
Tel. 040.8307097
Mobil 0171.6451283
[hidden email]