I think I had asked for this feature before, but...
As we have the onstop function which is used to trap the return button in the tablet, is it possible to have a onLeftArrow function to catch when that key is pressed?
The advantage of having this function is that we could check where we are in the program (using the getsymbol()) and take the appropriate action.
Trapping the left arrow key
Re: Trapping the left arrow key
To implement this behavior currently, you'd need to write a function that detects if you're moving forward/backwards and then add this function and your logic to a killfocus in every single field. This would be unwieldy.
If we implemented an OnBackwards what would be your common use cases?
If we implemented an OnBackwards what would be your common use cases?
Re: Trapping the left arrow key
The way we are programming, there are some situations where the left arrow key should not be accepted.
For example, we do not want to allow the user to step back to a previous form, so the idea would be when this function onbackwards is executed, that is, the user pressed the left arrow, the function would check if the getsymbol() is one of the very first variable in each block. In this case the left arrow is ignored and we skip back to where the cursor was with a reenter.
We already do that in the onstop() function, checking if the user is trying to stop at one of those critical points in the program. In those cases we issue an errmsg and reenter.
Did you get it?
If you have any better idea, plz tell me.
For example, we do not want to allow the user to step back to a previous form, so the idea would be when this function onbackwards is executed, that is, the user pressed the left arrow, the function would check if the getsymbol() is one of the very first variable in each block. In this case the left arrow is ignored and we skip back to where the cursor was with a reenter.
We already do that in the onstop() function, checking if the user is trying to stop at one of those critical points in the program. In those cases we issue an errmsg and reenter.
Did you get it?
If you have any better idea, plz tell me.
Best
Ari
Ari
-
- Posts: 1801
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Trapping the left arrow key
This is a bit of a hack, but if you have one final field (even if it's just a control field) on the form, you could prevent moving backwards with code like this:
If you need to 100% control what an operator has access to, I would write a menu program and bring up different data entry applications based on what an operator can see at any given moment.
PROC GLOBAL
numeric CanLeaveForm;
PROC MY_FORM
onfocus
CanLeaveForm = false;
killfocus
if not CanLeaveForm then
move FIRST_FIELD_ON_FORM advance;
endif;
PROC LAST_FIELD_ON_FORM
CanLeaveForm = true;
However, this isn't a 100% solution because operators can bypass this using the case tree.numeric CanLeaveForm;
PROC MY_FORM
onfocus
CanLeaveForm = false;
killfocus
if not CanLeaveForm then
move FIRST_FIELD_ON_FORM advance;
endif;
PROC LAST_FIELD_ON_FORM
CanLeaveForm = true;
If you need to 100% control what an operator has access to, I would write a menu program and bring up different data entry applications based on what an operator can see at any given moment.
Re: Trapping the left arrow key
Thanks Greg for the tip, I´ll try that.
I´m not worried about the case tree because we disconnected this option in the menu using the savesetting.
savesetting("CSEntry.Menu.ShowCaseTree", "No");
We are trying, as much as possible, for the enumerator not having much flexibility in the navigation. Our experience here is that they (enumerators) are very imaginative, if you know what I mean.
I´m not worried about the case tree because we disconnected this option in the menu using the savesetting.
savesetting("CSEntry.Menu.ShowCaseTree", "No");
We are trying, as much as possible, for the enumerator not having much flexibility in the navigation. Our experience here is that they (enumerators) are very imaginative, if you know what I mean.
Best
Ari
Ari
Re: Trapping the left arrow key
Sorry, but no cigar. It did not work, but not because of your technique.
The problem of applying it, in our case, is that we do not have several forms, one for each part of the questionnaire. We decided (maybe it was a bad decision) to have a single form with several "virtual" sub-forms. Each of these sub-forms one user-block of questions, and each one of them has a init_field at the beginning of the questions and an end_field at the end. But the physical form is unique, so, we cannot use the onfocus ... killfocus strategy for the form.
We already thought of using this kind of flag technique, and it seemed to be working well until it collided with the usage of the return key, which triggers the onstop function, and the flag prevented to do that.
The problem of applying it, in our case, is that we do not have several forms, one for each part of the questionnaire. We decided (maybe it was a bad decision) to have a single form with several "virtual" sub-forms. Each of these sub-forms one user-block of questions, and each one of them has a init_field at the beginning of the questions and an end_field at the end. But the physical form is unique, so, we cannot use the onfocus ... killfocus strategy for the form.
We already thought of using this kind of flag technique, and it seemed to be working well until it collided with the usage of the return key, which triggers the onstop function, and the flag prevented to do that.
Best
Ari
Ari