Project

General

Profile

Bug #10876

Date FILL-IN: Incorrect ENTER key handling in GUI mode

Added by Vladimir Tsichevski 8 months ago. Updated 6 months ago.

Status:
Internal Test
Priority:
Normal
Assignee:
Vladimir Tsichevski
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
16276
version_resolved:
reviewer:
production:
No
env_name:
topics:

Related issues

Related to User Interface - Bug #9913: DATE FILL-IN: Unexpected normalization on Enter and Tab keys WIP

History

#1 Updated by Vladimir Tsichevski 8 months ago

  • reviewer Hynek Cihlar added

Run any example with a date FILL-IN in GUI mode.

  1. Enter some valid date characters without completing the date, e.g., 0 / /.
  2. Press Enter.

In OE: Nothing happens.
In FWD: All date components are normalized.

#2 Updated by Vladimir Tsichevski 8 months ago

In OE CHARACTER mode, pressing Enter produces no visible effect, whereas in FWD, it does. Thus, the same issue occurs in ChUI mode as well.

The example used in both modes is:

SESSION:DATE-FORMAT = 'mdy'.
DEFINE VARIABLE dateField AS DATE VIEW-AS FILL-IN NO-UNDO FORMAT '99/99/9999'.
DEFINE FRAME f dateField NO-LABEL.
ENABLE ALL WITH FRAME f.
WAIT-FOR WINDOW-CLOSE OF FRAME f.

#3 Updated by Vladimir Tsichevski 8 months ago

The issue originates in the following code from FillIn.processKeyEvent() (line 1737):

  if (key == Keyboard.KA_RETURN)
  {
     if (isLinkedToBrowse())
     {
        ...
        return;
     }

     if (!completeEdit())
     {
        return;
     }

     if (ThinClient.getInstance().isChui() && isLastWidget)
     {
        ... do something
     }
     else if (getDataEntryReturn() || (ThinClient.isDataEntryReturn() && ke.isTriggerFired()))
     {
        if (groupMode && !isLastInGroup())
        {
           ... do something
        }
        else
        {
           if (isLastWidget)
           {
              ... do something
           }
           else
           {
              ... do something
           }
        }
     }

     refresh();
     return;
  }

The problem is that completeEdit() is called unconditionally even if no action for the RETURN key is selected. To resolve this:

  1. Identify which actions (marked as "... do something") require a prior call to completeEdit().
  2. Remove the unconditional completeEdit() call and add it only in the branches that truly require it.

#4 Updated by Vladimir Tsichevski 8 months ago

The Fix

The revised code relocates the completeEdit() call to the start of the relevant branch and moves refresh() to the end of that branch as well. The ThinClient.getInstance().isChui() && isLastWidget branch, which simply posts the GO event in CHARACTER mode, requires neither:

  if (key == Keyboard.KA_RETURN)
  {
     if (isLinkedToBrowse())
     {
        ... do something
        return;
     }
     ...
     if (ThinClient.getInstance().isChui() && isLastWidget)
     {
        ... post GO event
        return;
     }

     if (getDataEntryReturn() || (ThinClient.isDataEntryReturn() && ke.isTriggerFired()))
     {
        // FIXME: Do we need this here?
        if (!completeEdit())
        {
           return;
        }

        if (groupMode && !isLastInGroup())
        {
           ... do something
        }
        else if (isLastWidget)
        {
           ... do something
        }
        else
        {
           ... do something
        }

        refresh();
     }

     return;
  }

Notes on the Changes:

  1. The getDataEntryReturn() || (ThinClient.isDataEntryReturn() && ke.isTriggerFired()) branch has not been fully analyzed. Its logic appears complex and may introduce other discrepancies, but this fix should not affect its behavior or cause regressions.

#5 Updated by Vladimir Tsichevski 8 months ago

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

Fixed in 10876a rev. 16278. Please, review.

#6 Updated by Vladimir Tsichevski 8 months ago

  • Status changed from WIP to Review

#7 Updated by Hynek Cihlar 8 months ago

  • Assignee set to Vladimir Tsichevski

#8 Updated by Hynek Cihlar 8 months ago

Code review 10876a.

completeEdit is now not called for last widget in ChUI mode. Is this expected?

Why was the FIXME comment added, does it refer to completeEdit or the return statement?

#9 Updated by Vladimir Tsichevski 8 months ago

Hynek Cihlar wrote:

Code review 10876a.

completeEdit is now not called for last widget in ChUI mode. Is this expected?

Yes. See #10976-2 above:

In OE CHARACTER mode, pressing Enter produces no visible effect, whereas in FWD, it does. Thus, the same issue occurs in ChUI mode as well.

Why was the FIXME comment added, does it refer to completeEdit or the return statement?

My change does not affect this code fragment. This comment can be removed.

#10 Updated by Hynek Cihlar 7 months ago

  • Status changed from Review to Internal Test

Vladimir, please address the FIXME comment and go ahead with regression testing. ChUI regression tests will be also needed. Are you able to run them already?

#11 Updated by Vladimir Tsichevski 7 months ago

  • Related to Bug #9913: DATE FILL-IN: Unexpected normalization on Enter and Tab keys added

#12 Updated by Vladimir Tsichevski 7 months ago

Hynek Cihlar wrote:

Vladimir, please address the FIXME comment and go ahead with regression testing. ChUI regression tests will be also needed. Are you able to run them already?

Done in 10876a rev. 16332.

The fix also resolves #9913 specifically for the Enter key.

I verified it using the example from #10876-2 in both GUI and ChUI modes.
Additionally, I tested it with our large customer application - everything remains stable.

Hynek, run the ChUI test suite on my behalf.

#13 Updated by Hynek Cihlar 6 months ago

ChUI tests running.

#14 Updated by Hynek Cihlar 6 months ago

Vladimir, I found some regressions when running ChUI regression tests. Please see the results in devsrv01:/tmp files results_20260204132130.zip and results_20260204091019.zip, one set of results is from trunk the other from the branch.

#15 Updated by Hynek Cihlar 6 months ago

Vladimir, please make sure to check in any test cases that are still unchecked.

#16 Updated by Vladimir Tsichevski 6 months ago

Hynek Cihlar wrote:

Vladimir, please make sure to check in any test cases that are still unchecked.

No test program other than the one in #10876-2 is required.

#17 Updated by Vladimir Tsichevski 6 months ago

10876a rebased to r16411 and retested - no issues found.

Also available in: Atom PDF