comparison src/org/tn5250j/framework/tn5250/Screen5250.java @ 139:c2fa8ae31cfa

another attempt at setField()
author Carl Byington <carl@five-ten-sg.com>
date Fri, 20 Jun 2014 18:57:11 -0700
parents e312405090e1
children 4fe73e73d4d7
comparison
equal deleted inserted replaced
138:e312405090e1 139:c2fa8ae31cfa
2670 goto_XY(((row - 1) * numCols) + (col - 1)); 2670 goto_XY(((row - 1) * numCols) + (col - 1));
2671 } 2671 }
2672 2672
2673 // this routine is based on offset 0,0 not 1,1 2673 // this routine is based on offset 0,0 not 1,1
2674 protected void goto_XY(int pos) { 2674 protected void goto_XY(int pos) {
2675 // setCursorOff();
2676 updateCursorLoc();
2677 lastPos = pos; 2675 lastPos = pos;
2678 // setCursorOn();
2679 updateCursorLoc(); 2676 updateCursorLoc();
2680 } 2677 }
2681 2678
2682 /* 2679 /*
2683 * set the content of the field at (l,c) to data 2680 * set the content of the field at (l,c) to data
2685 */ 2682 */
2686 public void setField(int l, int c, char [] data) { 2683 public void setField(int l, int c, char [] data) {
2687 ScreenField cf; 2684 ScreenField cf;
2688 2685
2689 if (l >= 0) { 2686 if (l >= 0) {
2690 int position = l * numCols + c; 2687 if (screenFields.isCurrentFieldHighlightedEntry())
2691 isInField(position, true); 2688 unsetFieldHighlighted(screenFields.getCurrentField());
2692 cf = screenFields.getCurrentField(); 2689 int pos = l * numCols + c;
2693 lastPos = cf.getStartPos(); 2690 int n = screenFields.getSize();
2694 setDirty(lastPos); 2691 for (int i=0; i<n; i++) {
2692 cf = screenFields.getField(i);
2693 if (cf.getStartPos() == pos) {
2694 screenFields.setCurrentField(cf);
2695 if (screenFields.isCurrentFieldHighlightedEntry())
2696 setFieldHighlighted(screenFields.getCurrentField());
2697 gotoField(cf);
2698 isInField(pos);
2699 break;
2700 }
2701 }
2695 } 2702 }
2696 2703
2697 if ((data != null) && (data.length > 0)) { 2704 if ((data != null) && (data.length > 0)) {
2698 cf = screenFields.getCurrentField(); 2705 cf = screenFields.getCurrentField();
2699 cf.setString(new String(data)); 2706 cf.setString(new String(data));