Project

General

Profile

Bug #5363

Incorrect initial value in lastkey

Added by Roger Borrello almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:

History

#1 Updated by Roger Borrello almost 3 years ago

Testcase uast/messages_test.p illustrates we have the incorrect initial value in lastkey (which is set in the KeyReader.WorkArea to -401). Current version is 3821c_12412.

def var t1 as char.
form t1 with frame f1.
message "1. " + string(lastkey) keylabel(lastkey) keyfunction(lastkey).
message "2. " + string(lastkey) keylabel(lastkey) keyfunction(lastkey).
update t1 with frame f2.
message "3. " + string(lastkey) keylabel(lastkey) keyfunction(lastkey).
pause message "Done.".

4GL on Unix ChUI, Windows ChUI, and Windows GUI all show:

1. -1
2. -1

FWD ChUI shows:

1. 401 PF1 GO
2. 401 PF1 GO

FWD GUI shows:

1. 401 PF1
2. 401 PF1

A minor change to the initializer of lastkey to -1 changes this to the same 4GL results (ChUI and GUI):

1. -1
2. -1

Proposed change:

=== modified file 'src/com/goldencode/p2j/util/KeyReader.java'
--- src/com/goldencode/p2j/util/KeyReader.java    2021-01-13 21:04:41 +0000
+++ src/com/goldencode/p2j/util/KeyReader.java    2021-05-12 21:54:55 +0000
@@ -3,7 +3,7 @@
 ** Abstract : helper methods to manage reading a key/char and accessing the
 **            last key read
 **
-** Copyright (c) 2005-2020, Golden Code Development Corporation.
+** Copyright (c) 2005-2021, Golden Code Development Corporation.
 **
 ** -#- -I- --Date-- --JPRM-- ----------------------------------Description-----------------------------------
 ** 001 GES 20051109   @23284 Created initial version, supporting helper
@@ -63,6 +63,7 @@
 **                           support.
 **     OM  20201030          Invalid attribute API support for getters/setters.
 **     OM  20201203          Fixed handling of READ/ONLY attributes.
+** 028 RFB 20210512          Initial value of lastkey changed from 401 to -1.
 */

 /*
@@ -1070,7 +1071,7 @@
       private Long id = null;

       /** Stores the last key read from any source (stream or terminal). */
-      private int lastkey = 401;
+      private int lastkey = -1;

       /** Stores the last extended keys state. */
       private int lastKeyState = 0;

#2 Updated by Greg Shah almost 3 years ago

I have no objection to the change. You can put it in 3821c.

#3 Updated by Roger Borrello almost 3 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Feedback

Committed in rev 12413. I was trying to figure out why F1 would be the initial value, especially with your comment in there:

** 005 GES 20060207   @24326 Ensure that lastkey is set to -1 in case
**                           there is a StopConditionException while
**                           reading.

#4 Updated by Greg Shah almost 3 years ago

I don't know. But my history entry may not have been referring to the default value at startup.

#5 Updated by Greg Shah almost 3 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF