onEnterTabulate

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

onEnterTabulate

Herbert König
Hi,

from the docs I tried to make inputs tabulate on enter with:
  self form fieldSet do: [:field | field onEnterTabulate].

The fields I want to tabulate over are in a component.

No tabulation happens on enter regardless wether I put the line into
the view or into the component.

Guess I miss some additional incantation.

The view is:

viewKontrollwerte
        | e |
        e := WebElement new.
        e addTextH1: 'Elling Abrechnung ohne Schwerpunktsweg'.
        e addBreak;
                add: self viewTabComponent;
                addTextH1: 'Kontrollwerte (DA51) ändern'; addBreak;
                add: self viewKontrollwerteComponent ;
                addBreak.
        self form fieldSet do: [:field | field onEnterTabulate].
        self pageFrameWith: e title: 'REB Elling'

The component somewhat abbreviated goes like:

viewKontrollwerteComponent
        "reusable print and Edit Kontrollwerte"
        | e da51|
        da51 := self observee abrechnung kontrollwerte.
        e := WebElement new.
        e cell  addText: 'KWX:'.
        e newCell addDelayedFieldAspect: #kwxText for: da51.
        e  newRow.
        e cell  addText: 'KWY:'.
        e newCell addDelayedFieldAspect: #kwyText for: da51.
        e  newRow.

        "Some more of these follow"
       
        ^e


Thanks,


Herbert                          mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: onEnterTabulate

Janko Mivšek
Hi Herbert,

I hope I'm not to late with answer, sorry!

About #onEnterTabulate (which enables a very handy tabulation between
fields with ENTER key, not just with TAB), you better send it
immediately to fields when building your form. In your case:

viewKontrollwerteComponent
         "reusable print and Edit Kontrollwerte"
         | e da51|
         da51 := self observee abrechnung kontrollwerte.
         e := WebElement new.
         e cell  addText: 'KWX:'.
         (e newCell addDelayedFieldAspect: #kwxText for: da51)
                onEnterTabulate.
         e  newRow.
         e cell  addText: 'KWY:'.
         (e newCell addDelayedFieldAspect: #kwyText for: da51)
                onEnterTabulate.
         e  newRow.

Then you don't need to use self form fieldSet do: [...onEnterTabulate]
in your view.

Also, I didn't check if tabulation with Enter is working on delayed
fields. I'd check that by trying first with normal fields.

One suggestion, avoid naming components as #viewSomethingComponent,
because #view.. method start is reserved for view methods, to avoid
confusion.

Best regards
Janko

Herbert König pravi:

> Hi,
>
> from the docs I tried to make inputs tabulate on enter with:
>   self form fieldSet do: [:field | field onEnterTabulate].
>
> The fields I want to tabulate over are in a component.
>
> No tabulation happens on enter regardless wether I put the line into
> the view or into the component.
>
> Guess I miss some additional incantation.
>
> The view is:
>
> viewKontrollwerte
>         | e |
>         e := WebElement new.
>         e addTextH1: 'Elling Abrechnung ohne Schwerpunktsweg'.
>         e addBreak;
>                 add: self viewTabComponent;
>                 addTextH1: 'Kontrollwerte (DA51) ändern'; addBreak;
>                 add: self viewKontrollwerteComponent ;
>                 addBreak.
>         self form fieldSet do: [:field | field onEnterTabulate].
>         self pageFrameWith: e title: 'REB Elling'
>
> The component somewhat abbreviated goes like:
>
> viewKontrollwerteComponent
>         "reusable print and Edit Kontrollwerte"
>         | e da51|
>         da51 := self observee abrechnung kontrollwerte.
>         e := WebElement new.
>         e cell  addText: 'KWX:'.
>         e newCell addDelayedFieldAspect: #kwxText for: da51.
>         e  newRow.
>         e cell  addText: 'KWY:'.
>         e newCell addDelayedFieldAspect: #kwyText for: da51.
>         e  newRow.
>
>         "Some more of these follow"
>        
>         ^e
>
>
> Thanks,
>
>
> Herbert                          mailto:[hidden email]
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: onEnterTabulate

Herbert König
Hi Janko,


JM> I hope I'm not to late with answer, sorry!
no I have enough other things to do.


JM> About #onEnterTabulate (which enables a very handy tabulation between
JM> fields with ENTER key, not just with TAB), you better send it
JM> immediately to fields when building your form. In your case:

I tried this and replaced addDelayedFieldAspect with
addInputFieldAspect. For example:
(e newCell addInputFieldAspect: #kwxText for: da51) onEnterTabulate.
But I didn't tabulate the last one (where should it tabulate to?).

JM> viewKontrollwerteComponent
JM>          "reusable print and Edit Kontrollwerte"
JM>          (e newCell addDelayedFieldAspect: #kwxText for: da51)
JM> onEnterTabulate.


JM> Then you don't need to use self form fieldSet do: [...onEnterTabulate]
JM> in your view.

which I removed.
I get a debugger (attached) because the WebInputField has no ID. I
cross checked, that I didn't mess it up with my renaming but removing
all onEnterTabulate gets it working again.

Maybe this was the first reason why I tried the form fieldSet.

So I put it back in (the fieldSet loop).
But this still doesn't tabulate though I have no more delayed fields.
I thought it has to do with tab order, maybe the next in tab order is
just the following element (e cell addText:) which isn't an InputFild
and so doesn't react on the next enter?

JM> Also, I didn't check if tabulation with Enter is working on delayed
JM> fields. I'd check that by trying first with normal fields.

see above.

JM> One suggestion, avoid naming components as #viewSomethingComponent,
JM> because #view.. method start is reserved for view methods, to avoid
JM> confusion.

I renamed the methods to display...Component, I got several of them.
If you suggest a better name for those component methods, I'm all
ears. Maybe just ...Component?

I got the idea for the name from the docs, lists and tabs, there
especially viewTabComponent to place tabs on every view.

If you give me access I'll change that in the docs. And we might want
to settle the naming of these reusable component methods as a
convention and add it to the docs.



Thanks,

Herbert                            mailto:[hidden email]
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

debugger.png (51K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: onEnterTabulate

Herbert König
Hi,


JM>> Then you don't need to use self form fieldSet do: [...onEnterTabulate]
JM>> in your view.

just another data point:

form fieldSet do: [..] does not work because at any time I send it,
e form fieldSet returns an empty set.

While inspecting e form shows all fields with enterTab = nil.

And adding self enterTab: true to WebInputField>>initialize gets me a
debugger, more or less the same as before.


Cheers,

Herbert                            mailto:[hidden email]
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

debugger2.png (44K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: onEnterTabulate

Janko Mivšek
Herbert,

I need to write a short example to investigate this problem more
thoroughly. Which Aida exactly you use? On Squeak, right?

Janko

Herbert König pravi:

> Hi,
>
>
> JM>> Then you don't need to use self form fieldSet do: [...onEnterTabulate]
> JM>> in your view.
>
> just another data point:
>
> form fieldSet do: [..] does not work because at any time I send it,
> e form fieldSet returns an empty set.
>
> While inspecting e form shows all fields with enterTab = nil.
>
> And adding self enterTab: true to WebInputField>>initialize gets me a
> debugger, more or less the same as before.
>
>
> Cheers,
>
> Herbert                            mailto:[hidden email]
>


--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: onEnterTabulate

Herbert König
Hi Janko,


JM> I need to write a short example to investigate this problem more
JM> thoroughly. Which Aida exactly you use? On Squeak, right?


Squeak 3.8.2 and Aida 5.6 (current stable Version).

One of these days I have to learn how to debug Aida (how to debug
processes). I wouldn't mind debugging these things myself, but 0 halt
doesn't work as expected (by me that is :-) and I just can open
inspectors in the code to see the state of things.



Cheers,

Herbert                            mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: onEnterTabulate

Alex Baran
Hi Herbert,

It was interesting to examine your case. The problem, as you already
mentioned, is in absent id.
It can be solved for example in such way:

(e newCell addDelayedFieldAspect: #kwxText for: da51)
              registerId;
              onEnterTabulate.

Then tabulation on Enter will work, at least it so on VW and Aida 5.6.

Of course is better to have Aida to do it for you, so
WebFormElement>>onEnterTabulateTo: can be changed to something like:

WebFormElement>>onEnterTabulateTo: aFormElementOrId
...
        nextId := (aFormElementOrId isKindOf: WebElement)
                ifTrue: [aFormElementOrId idLazy    "___ instead of just id "]
ifFalse: [aFormElementOrId asString].
...

WebElement>>idLazy
        self id isNil ifTrue: [self registerId].
       
        ^self id

And know you don't need to call registerId for each component. I'm not
sure if this code will work in all situations, actually I can imagine
one case when it will not, but I think that it's better to have Aida
doing registration for you one way or another. It will be interesting
to know Janko opinion.


And using

self form fieldSet do: [:field | field onEnterTabulate].

it is not good idea IMHO, in that situation fieldSet is empty. It's
because Aida first create WebElements hirerarchy and only later make
traversal to find form fields.


Hope this help,
Alex Baran

2009/4/3 Herbert König <[hidden email]>:

> Hi Janko,
>
>
> JM> I need to write a short example to investigate this problem more
> JM> thoroughly. Which Aida exactly you use? On Squeak, right?
>
>
> Squeak 3.8.2 and Aida 5.6 (current stable Version).
>
> One of these days I have to learn how to debug Aida (how to debug
> processes). I wouldn't mind debugging these things myself, but 0 halt
> doesn't work as expected (by me that is :-) and I just can open
> inspectors in the code to see the state of things.
>
>
>
> Cheers,
>
> Herbert                            mailto:[hidden email]
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: onEnterTabulate

Herbert König
Hi Alex,


AB> It was interesting to examine your case. The problem, as you already
AB> mentioned, is in absent id.
AB> It can be solved for example in such way:

thanks a lot for taking the time!

AB> (e newCell addDelayedFieldAspect: #kwxText for: da51)
AB>               registerId;
AB>               onEnterTabulate.

this works on Squeak and Aida5.6 too.

AB> Of course is better to have Aida to do it for you, so
WebFormElement>>>onEnterTabulateTo: can be changed to something like:

AB> ifTrue: [aFormElementOrId idLazy    "___ instead of just id "]
...
WebElement>>>idLazy
...
These work too. I feel this is a bug fix (or a proposal of one) more
than an enh.

AB> And know you don't need to call registerId for each component. I'm not
AB> sure if this code will work in all situations, actually I can imagine
AB> one case when it will not, but I think that it's better to have Aida
AB> doing registration for you one way or another.

Oh yes, though in my case I have added one more method:

addDelayedTabbingAspect: aSymbol for: anObject
   ^self add: ((WebDelayedField new aspect:  aSymbol for: anObject)
                 registerId; onEnterTabulate )

to WebElement.

My app is mainly about numeric data entry so i use it a lot.


AB> And using

AB> self form fieldSet do: [:field | field onEnterTabulate].

AB> it is not good idea IMHO, in that situation fieldSet is empty. It's
AB> because Aida first create WebElements hirerarchy and only later make
AB> traversal to find form fields.

well yes but having this method handy would shorten some view methods.
And it's said so in the docs which I again offer to correct in this
regard.

AB> Hope this help,
Thanks again Alex,


Herbert                            mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: onEnterTabulate

Alex Baran
Hi Herbert,

2009/4/5 Herbert König <[hidden email]>:
> thanks a lot for taking the time!

My pleasure!

> Oh yes, though in my case I have added one more method:
>
> addDelayedTabbingAspect: aSymbol for: anObject
>   ^self add: ((WebDelayedField new aspect:  aSymbol for: anObject)
>                 registerId; onEnterTabulate )
>
> to WebElement.
>
> My app is mainly about numeric data entry so i use it a lot.

Seems like interesting and natural solution that don't require
modifying of Aida code.

> AB> And using
>
> AB> self form fieldSet do: [:field | field onEnterTabulate].
>
> AB> it is not good idea IMHO, in that situation fieldSet is empty. It's
> AB> because Aida first create WebElements hirerarchy and only later make
> AB> traversal to find form fields.
>
> well yes but having this method handy would shorten some view methods.
> And it's said so in the docs which I again offer to correct in this
> regard.

Actually I should check doc first, precedence is what I found by code
inspection.


All the best,
Alex Baran
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida