From c67bbde39b5da9d1ff74279fa58fb70a0afa6a7a Mon Sep 17 00:00:00 2001 From: Irwin Rodriguez Date: Sat, 15 Aug 2026 11:55:52 +0200 Subject: [PATCH] Fix WAIT WINDOW when the message follows WINDOW --- src/Common/FoxProCmd.xh | 12 +++ .../XSharp.VFP.Tests/WaitCommandTests.prg | 73 +++++++++++++++++++ .../XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj | 1 + 3 files changed, 86 insertions(+) create mode 100644 src/Runtime/XSharp.VFP.Tests/WaitCommandTests.prg diff --git a/src/Common/FoxProCmd.xh b/src/Common/FoxProCmd.xh index 214a9a7e21..cb11c197c5 100644 --- a/src/Common/FoxProCmd.xh +++ b/src/Common/FoxProCmd.xh @@ -169,6 +169,18 @@ #xcommand WAIT TO [ [AT , ]] [] [] [TIMEOUT ] ; => := __VfpWait(, <.win.>, , , <.now.>, <.nclr.>, ) +#xcommand WAIT WINDOW [AT , ] [] [] [TIMEOUT ] ; + => __VfpWait(, TRUE, , , <.now.>, <.nclr.>, ) + +#xcommand WAIT WINDOW TO [AT , ] [] [] [TIMEOUT ] ; + => := __VfpWait(, TRUE, , , <.now.>, <.nclr.>, ) + +#xcommand WAIT WINDOW AT , TO [] [] [TIMEOUT ] ; + => := __VfpWait(, TRUE, , , <.now.>, <.nclr.>, ) + +#xcommand WAIT WINDOW TO [AT , ] [] [] [TIMEOUT ] ; + => := __VfpWait(NIL, TRUE, , , <.now.>, <.nclr.>, ) + #xcommand WAIT [ [AT , ]] [] [] [TIMEOUT ] ; => __VfpWait(NIL, <.win.>, , , <.now.>, <.nclr.>, ) diff --git a/src/Runtime/XSharp.VFP.Tests/WaitCommandTests.prg b/src/Runtime/XSharp.VFP.Tests/WaitCommandTests.prg new file mode 100644 index 0000000000..7e323bd0cf --- /dev/null +++ b/src/Runtime/XSharp.VFP.Tests/WaitCommandTests.prg @@ -0,0 +1,73 @@ +// +// Copyright (c) XSharp B.V. All Rights Reserved. +// Licensed under the Apache License, Version 2.0. +// See License.txt in the project root for license information. +// + +USING System +USING XUnit + +BEGIN NAMESPACE XSharp.VFP.Tests + CLASS WaitCommandTests + + STATIC CONSTRUCTOR + XSharp.RuntimeState.Dialect := XSharpDialect.FoxPro + END CONSTRUCTOR + + [Fact, Trait("Category", "Wait")]; + METHOD WaitWindowAcceptsTheMessageAfterTheWindowKeyword AS VOID + WAIT WINDOW "x" NOWAIT + WAIT WINDOW "x" AT 10, 20 NOWAIT + WAIT WINDOW "x" NOWAIT NOCLEAR + END METHOD + + [Fact, Trait("Category", "Wait")]; + METHOD WaitWindowWithMessageStoresTheResult AS VOID + LOCAL cKey AS STRING + cKey := "unset" + WAIT WINDOW "x" TO cKey NOWAIT + Assert.Equal("", cKey) + END METHOD + + [Fact, Trait("Category", "Wait")]; + METHOD WaitWindowAcceptsAtBeforeTo AS VOID + LOCAL cKey AS STRING + cKey := "unset" + WAIT WINDOW "x" AT 10, 20 TO cKey NOWAIT + Assert.Equal("", cKey) + END METHOD + + [Fact, Trait("Category", "Wait")]; + METHOD WaitWindowAcceptsToBeforeAt AS VOID + LOCAL cKey AS STRING + cKey := "unset" + WAIT WINDOW "x" TO cKey AT 10, 20 NOWAIT + Assert.Equal("", cKey) + END METHOD + + [Fact, Trait("Category", "Wait")]; + METHOD WaitWindowWithoutMessageStoresTheResult AS VOID + LOCAL cKey AS STRING + cKey := "unset" + WAIT WINDOW TO cKey NOWAIT + Assert.Equal("", cKey) + END METHOD + + [Fact, Trait("Category", "Wait")]; + METHOD WaitStillAcceptsTheMessageBeforeTheWindowKeyword AS VOID + LOCAL cKey AS STRING + cKey := "unset" + WAIT "x" WINDOW NOWAIT + WAIT "x" TO cKey WINDOW AT 3, 3 NOWAIT + Assert.Equal("", cKey) + END METHOD + + [Fact, Trait("Category", "Wait")]; + METHOD WaitWithoutMessageStillWorks AS VOID + WAIT WINDOW NOWAIT + WAIT WINDOW AT 5, 5 NOWAIT + WAIT CLEAR + END METHOD + + END CLASS +END NAMESPACE diff --git a/src/Runtime/XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj b/src/Runtime/XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj index 8b0ac00a1d..84d64185fb 100644 --- a/src/Runtime/XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj +++ b/src/Runtime/XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj @@ -119,6 +119,7 @@ +