On Enter Select

Hi,
is there a way to get a method to act when someone presses enter?

enter where?

On the form? If so the answer is no.
In a field? The answer is yes, use the onAction event…

yes, on the form…
For people who are entering data all day, it would be nice to tab thru the fields and then press enter → make new record…tab tab tab…enter ->new record

Any other ideas on this?

Yep, like said. Attach a method to your onaction event and let that do what you want…

IT2BE:
Yep, like said. Attach a method to your onaction event and let that do what you want…

Not sure what you are thinking. Onaction only works on non-editable field, and when you are tabbing through your fields, the non-editable field with an OnAction is not triggered.

Onaction only works on non-editable field

Have you tested that? It works! At least in Record view…

and when you are tabbing through your fields, the non-editable field with an OnAction is not triggered.

Butt tabbing shouldn’t trigger the onAction because you want it to react on the enter key!? Right… Tabbing will trigger an event ‘onFocusLost’…

IT2BE:

Onaction only works on non-editable field

Have you tested that? It works! At least in Record view…

With me it doesn’t trigger an onAction when the field is editable in Record-View. Other triggers work for exampe onfocusGained (by the way dont try an OnfocusGained and run a method that starts a dialogs :roll: )

IT2BE:
But tabbing shouldn’t trigger the onAction because you want it to react on the enter key!? Right… Tabbing will trigger an event ‘onFocusLost’…

But then I dont see where you are going with this. I believe we dont understand each other.
I have a form with 10 fields on them. I start at field 1, tab fill in field2, tab tab etc…and then when I give enter some method should be running (at least that’s what I want)

On field 10 have a “onFocusLost” even that will ask if they want to create a new record.

OR you can have a “quick data entry mode” (name needs work) where it will make a new record after leaving the 10th field (and probably after some validation). Then they can “turn off” that mode for “normal” entry and editing.

Just a thought.

It is not very handy… accepting when finishing editing the last field. You might want to edit the records later and modify some other field and pressing Enter would not help you… or the same case when the last field is by default filled with something and is not always modified - you don’t always get the focus there.

I also encountered the need of having such an event and did not manage to find a good solution yet. I felt the need of defining an “Accept” button, which is clicked when pressing Enter.

Best,
Adrian

bcusick:
On field 10 have a “onFocusLost” even that will ask if they want to create a new record.

OR you can have a “quick data entry mode” (name needs work) where it will make a new record after leaving the 10th field (and probably after some validation). Then they can “turn off” that mode for “normal” entry and editing.

Just a thought.

It is a good thought but what happens if one wants to exit after field 9 or 8…and what if it’s a list/table view for example
I am gonna do some experimenting, but an OnSelectEnter and/or OnSelectTab might be a cool new feature…especially for people who has to do a lot of data-entry, they just dont wanna use the mouse becoz it is to time-consuming

Why don’t you put a “new record” focusable button in the tab order just after the last field and let your users tab to the button and trigger the method using the return key?

Fast, no-mouse, easily remembered data entry and form navigation are two things that are always high on my list of priorities. Another way to handle this that I use is a global method and assign a key stroke to it (Servoy added a number of months ago and has been great for me). So I use the command-1 key since we are Mac-based for this event. The method will then save data and do whatever is appropriate on a particular form (create new record, go to a related record, find a new patient record, give them an option or whatever).

I have taken it a step further even and have almost a no-mouse navigation system in most of my solutions that need heavy data entry. This allows the user to jump from tab to tab, portal row to portal row without ever touching the mouse just using global methods assigned to easily remembered key strokes.

john.allen:
Another way to handle this that I use is a global method and assign a key stroke to it (Servoy added a number of months ago and has been great for me

Could you elaborate on this. Becoz I am not sure what you mean…but it sure sounds interesting. Do you mean that whenever you hit Ctrl-1 it runs a global method? Or do you run a global method that is listening to the keystrokes?

Do you mean that whenever you hit Ctrl-1 it runs a global method?

That’s what I do. I find that hitting a simple keystroke combination like Command-1 (Cntrl-1 on Windows) is just about as easy as hitting the return key. You have up to nine assignable global methods with Servoy and, since you can figure out the form the user is on, you can assign one of the key combos for creating a new record, another for saving a record, another for cycling through the tab panels or whatever and then keep that behavior consistent throughout the solution.

john.allen:

Do you mean that whenever you hit Ctrl-1 it runs a global method?

That’s what I do. I find that hitting a simple keystroke combination like Command-1 (Cntrl-1 on Windows) is just about as easy as hitting the return key. You have up to nine assignable global methods with Servoy and, since you can figure out the form the user is on, you can assign one of the key combos for creating a new record, another for saving a record, another for cycling through the tab panels or whatever and then keep that behavior consistent throughout the solution.

Okay…now I see them…they are assigned automatically to the first 9 global method (which I find dangerous, becoz now I have 9 methods at random attached to the Ctrl buttons)…I was looking for something to assign them (that’s why I couldn’t them)…this is great…This will work fine or me. NOw I am gonna test it in if it works in a application.showFormInDialog too.

Well it DOESN’T work in application.showFormInDialog :cry:

Hmm, time to buy the menubar plugin?

IT2BE:
Hmm, time to buy the menubar plugin?

Does it also work in forms in a dialog?

Should be the case, just test it. In the future it will also be possible to add the menubar to a form in dialog.

Okay…now I see them…they are assigned automatically to the first 9 global method (which I find dangerous, becoz now I have 9 methods at random attached to the Ctrl buttons)…I was looking for something to assign them (that’s why I couldn’t them)

The way I assign them is to give them a number to start with. I think Servoy objects if the first character is a number so I start them all off with an underscore and then a number so they always stay in the same order like ‘_1Save’, ‘_2NewRecord’, ‘_3NextForm’, etc.

Well it DOESN’T work in application.showFormInDialog

I didn’t remember that but I don’t really use ‘FormInDialog’ that much for straight dataentry. I mostly switch from tab-to-tab, portalrow-to-portalrow again via assignable keys tied to global methods that do that navigation as mentioned in my earlier post. When I do use FormInDialog for dataentry, generally it is for something much more limited. By that I mean I won’t be filling out a whole ‘form’ with many fields but rather just a limited number of ‘MUST ENTER’ fields. Then I assign a method to OnDataChange, OnFocusLost or whatever so again eliminating mousing or extra keystrokes.

Marcel, one of these days I must get around to playing with your Menu plugin. I know there must be a million things I could do with it! I just need the time to mess around with it. :)

John

I have exactly the same question.
I need to have a possibility that on Enter that some global method is executed (so not with CTRL-1 etc).
I don’t want solutions like methods that work on individual fields.
I see 2 possible solutions:

  1. Like the CTRL-1 solution, create a possibility to use a global method with the name ENTER like the existing 1.

  2. Add an extra possibility to buttons where you can select some key (or key-combination like CTRL-1, Shift-F6 etc). This should work application based and not just form based. Because my application shows several forms (including some general toolbar form).

The second solution seems to be the best solution.
Since this posting dates from some while ago, I would like to know if there is today already a solution like this. I’m using Servoy 3.5