comparison src/org/tn5250j/framework/tn5250/Screen5250.java @ 187:81f9ba83c0e9

setfield positions the cursor properly as if the characters were typed
author Carl Byington <carl@five-ten-sg.com>
date Wed, 02 Jul 2014 15:40:18 -0700
parents 61a90cb1938d
children 561caa2f7c17
comparison
equal deleted inserted replaced
186:61a90cb1938d 187:81f9ba83c0e9
2660 ScreenField cf; 2660 ScreenField cf;
2661 2661
2662 if (l >= 0) { 2662 if (l >= 0) {
2663 int position = l * numCols + c; 2663 int position = l * numCols + c;
2664 if (!isInField(position, true)) { 2664 if (!isInField(position, true)) {
2665 gotoFieldNext(); 2665 lastPos = position;
2666 isInField(); 2666 while (!isInField()) advancePos();
2667 cf = screenFields.getCurrentField(); 2667 cf = screenFields.getCurrentField();
2668 lastPos = cf.getStartPos(); 2668 lastPos = cf.getStartPos();
2669 } 2669 }
2670 else { 2670 else {
2671 lastPos = position; 2671 lastPos = position;
3574 * 3574 *
3575 * @param i 3575 * @param i
3576 */ 3576 */
3577 protected void changePos(int i) { 3577 protected void changePos(int i) {
3578 lastPos += i; 3578 lastPos += i;
3579 3579 while (lastPos < 0) lastPos += lenScreen;
3580 if (lastPos < 0) 3580 while (lastPos >= lenScreen) lastPos -= lenScreen;
3581 lastPos = lenScreen + lastPos; 3581 }
3582 3582
3583 if (lastPos > lenScreen - 1)
3584 lastPos = lastPos - lenScreen;
3585
3586 // System.out.println(lastRow + "," + ((lastPos) / numCols) + "," +
3587 // lastCol + "," + ((lastPos) % numCols) + "," +
3588 // ((lastRow * numCols) + lastCol) + "," +
3589 // (lastPos));
3590 }
3591 3583
3592 protected void goHome() { 3584 protected void goHome() {
3593 // now we try to move to first input field according to 3585 // now we try to move to first input field according to
3594 // 14.6 WRITE TO DISPLAY Command 3586 // 14.6 WRITE TO DISPLAY Command
3595 // ? If the WTD command is valid, after the command is processed, 3587 // ? If the WTD command is valid, after the command is processed,