changeset 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
files src/org/tn5250j/framework/tn5250/Screen5250.java
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tn5250j/framework/tn5250/Screen5250.java	Fri Jun 20 15:03:05 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/Screen5250.java	Fri Jun 20 18:57:11 2014 -0700
@@ -2672,10 +2672,7 @@
 
     // this routine is based on offset 0,0 not 1,1
     protected void goto_XY(int pos) {
-        //      setCursorOff();
-        updateCursorLoc();
         lastPos = pos;
-        //      setCursorOn();
         updateCursorLoc();
     }
 
@@ -2687,11 +2684,21 @@
         ScreenField cf;
 
         if (l >= 0) {
-            int position = l * numCols + c;
-            isInField(position, true);
-            cf = screenFields.getCurrentField();
-            lastPos = cf.getStartPos();
-            setDirty(lastPos);
+            if (screenFields.isCurrentFieldHighlightedEntry())
+                unsetFieldHighlighted(screenFields.getCurrentField());
+            int pos = l * numCols + c;
+            int   n = screenFields.getSize();
+            for (int i=0; i<n; i++) {
+                cf = screenFields.getField(i);
+                if (cf.getStartPos() == pos) {
+                    screenFields.setCurrentField(cf);
+                    if (screenFields.isCurrentFieldHighlightedEntry())
+                        setFieldHighlighted(screenFields.getCurrentField());
+                    gotoField(cf);
+                    isInField(pos);
+                    break;
+                }
+            }
         }
 
         if ((data != null) && (data.length > 0)) {