comparison src/org/tn5250j/framework/tn5250/Screen5250.java @ 141:13cea57ac61e

test setfield() cursor movement always sets the field contents
author Carl Byington <carl@five-ten-sg.com>
date Sat, 21 Jun 2014 07:30:09 -0700
parents 4fe73e73d4d7
children 8754f293f2fd
comparison
equal deleted inserted replaced
140:4fe73e73d4d7 141:13cea57ac61e
2683 */ 2683 */
2684 public void setField(int l, int c, char [] data) { 2684 public void setField(int l, int c, char [] data) {
2685 ScreenField cf; 2685 ScreenField cf;
2686 2686
2687 if (l >= 0) { 2687 if (l >= 0) {
2688 if (screenFields.isCurrentFieldHighlightedEntry()) 2688 int position = l * numCols + c;
2689 unsetFieldHighlighted(screenFields.getCurrentField()); 2689 isInField(position, true);
2690 int pos = l * numCols + c; 2690 cf = screenFields.getCurrentField();
2691 int n = screenFields.getSize(); 2691 lastPos = cf.getStartPos();
2692 for (int i=0; i<n; i++) { 2692 setDirty(lastPos);
2693 cf = screenFields.getField(i);
2694 if (cf.getStartPos() == pos) {
2695 screenFields.setCurrentField(cf);
2696 if (screenFields.isCurrentFieldHighlightedEntry())
2697 setFieldHighlighted(screenFields.getCurrentField());
2698 gotoField(cf);
2699 isInField(pos);
2700 break;
2701 }
2702 }
2703 } 2693 }
2704 2694
2705 if ((data != null) && (data.length > 0)) { 2695 if ((data != null) && (data.length > 0)) {
2706 cf = screenFields.getCurrentField(); 2696 cf = screenFields.getCurrentField();
2707 cf.setString(new String(data)); 2697 cf.setString(new String(data));