I have a map in which there are five fields given as below:-
All are modifiable fields. When the cursor is at Last and tab is pressed then cursor is moved to Roll, I want the cursor to be moved to Sub and when tab is pressed at Total then cusror must be moved to Roll.
Is there any way?
As with many things in Natural, there is a simple answer, and an involved answer.
The simple answer is NO. Natural maps always “tab” geographically, left to right, top to bottom.
The more complicated answer involves programming and potentially re-educating users about how to “tab”.
You can establish a PF key, say PF5, as the “tab key”. After the INPUT statement, you test for PF5. If PF5 has been pressed, you check a variable where you keep track of where you are. You now change this variable and then do a REINPUT using MARK to position the cursor at the next position.
WARNING. This can get very messy. First, the tab key will still work. This means that you probably should read *CURS-COL and *CURS-LINE to figure out where the cursor is, rather than use a “tracking variable”.
Make sure the users are “okay” with using a PF key to tab.
But the reason why it does not work is not Natural but the 3270 block mode. When a map is displayed (whether it is Cobol or Natural or any other map) the issuing program is suspended. The user can move the cursor everywhere on the map. If he/she presses a tab key, the cursor moves to the next input location, that is the next location from left to right and top to bottom. The program receives control when a function key or enter or PA key is pressed.
Many users are familiar with this left-to-right and top-to-bottom tabbing, even in GUI environments. If the cursor steps criss-cross all over the fields when pressing tab, the fields are not ordered correctly on the screen. Instead of changing the tabbing sequence you should change the field positions on the map. Please, don’t follow Steve’s advice as it only shows, if you manage it, that you are able to build high-sophisticated user-interfaces, but that you do not think of the users, that should use your user interfaces without having your wonderful brain.